Exemple #1
0
if TFT_IS_PORTRAIT:
    TOUCH_CALI_FILE = "touch_cali_PORTRAIT.json"  #保存为竖屏触摸参数
else:
    TOUCH_CALI_FILE = "touch_cali_LANDSCAPE.json"  #保存为横屏触摸参数

#从没做过触摸校准
if TOUCH_CALI_FILE not in uos.listdir():
    touch = xpt2046(
        cs=TOUCH_CS,
        transpose=TFT_IS_PORTRAIT,
    )

    from touch_cali import TouchCali

    touch_cali = TouchCali(touch, TOUCH_CALI_FILE)
    touch_cali.start()

#已经做过触摸校准,直接调用触摸参数文件
else:
    with open(TOUCH_CALI_FILE, 'r') as f:
        param = ujson.load(f)
        touch_x0 = param['cal_x0']
        touch_x1 = param['cal_x1']
        touch_y0 = param['cal_y0']
        touch_y1 = param['cal_y1']

    touch = xpt2046(
        cs=TOUCH_CS,
        transpose=TFT_IS_PORTRAIT,
        cal_x0=touch_x0,
Exemple #2
0
               width=240 if config['tft_pins']['is_portrait'] else 320,
               height=320 if config['tft_pins']['is_portrait'] else 240,
               rot=ili9341.PORTRAIT
               if config['tft_pins']['is_portrait'] else ili9341.LANDSCAPE)

touch_args = {}
if config.get('touch_cali_file') in uos.listdir():
    with open(config.get('touch_cali_file'), 'r') as f:
        touch_args = ujson.load(f)
touch_args['cs'] = config['touch_pins']['cs']
touch_args['transpose'] = config['tft_pins']['is_portrait']
touch = xpt2046(**touch_args)

if config.get('touch_cali_file') not in uos.listdir():
    from touch_cali import TouchCali
    touch_cali = TouchCali(touch, config)
    touch_cali.start()
else:
    import gc
    import utime
    import _thread
    from buzzer import Buzzer
    from gui import GUI
    from load_profiles import LoadProfiles
    from oven_control import OvenControl
    from pid import PID

    if config.get('sensor_type') == 'MAX6675':
        from max6675 import MAX6675 as Sensor
    else:
        from max31855 import MAX31855 as Sensor