def make_Poweroff(self): print("Power off after 5s") try: if utils.isRaspberryPi(): subprocess.Popen("(sleep 5 ; exec sudo halt) &", stdout=subprocess.PIPE, shell=True) except: pass
def make_Reboot(self): print("Reboot after 5s") try: if utils.isRaspberryPi(): subprocess.Popen("(sleep 5 ; exec sudo reboot) &", stdout=subprocess.PIPE, shell=True) except: pass
def lcdInit(): if utils.isRaspberryPi(): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) DC = 25 LED = 18 RST = 0 return LCDTFT(spidev.SpiDev(), DC, RST, LED) else: return FakeTFT()
def __init__(self, image = None, x = 0, y = 0, cId = 0): self.photoImage = None self.x = x self.y = y self.width = 0 self.height = 0 self.cId = cId self.tkID = None self.tftImage = None self.photoImage = None self.useTk = utils.isRaspberryPi() is False if image is not None: self.setImage(image)
# Universal LCD UI Library for Raspberry Pi with Fake class for Windows/OSX debugging # [email protected] # LCD/FakeLCD Library class. import os, sys, time import numpy as np from PIL import Image import utils from lcdfonts import * from ILI9340 import * if utils.isRaspberryPi(): import spidev import RPi.GPIO as GPIO else: import tkinter from PIL import ImageTk, Image # Display resolution TFTWIDTH = 320 TFTHEIGHT = 240 # Hardware button pins tftPin1 = 17 tftPin2 = 22 tftPin3 = 23 tftPin4 = 27 # Primitives class UIImage:
if args.lcd == 'False' or args.lcd == 'false' or args.lcd == '0': no_lcd = True print("LCD in use:", "no" if no_lcd else "yes") rtl_found = checkRTLSDR() print("") loadCapcodesDict("capcodes.txt") loadCapcodesDict("capcodesPrivate.txt") print("Capcodes: {} records loaded".format(len(capcodesDict.keys()))) loadFilter(args.filter) print("Filter: {} strings loaded".format(len(filtersList))) print("") # Debug=True - without receiver, for simulation: gcc debugtest.c -odebugtest) if utils.isRaspberryPi() is False: debug = True if rtl_found is False and debug is False: print("App done, configuration is not complete") sys.exit(0) # Data receiving thread def dataThreadFunc(): global is_active, mainView, frequency, messages, capcodesDict, debug cmd = "rtl_fm -f {} -M fm -s 22050 -g {} -p {} | multimon-ng -a FLEX -t raw -".format( frequency, gain, correction) print("Run process", cmd) if debug: abs_path = os.path.abspath(__file__)