Example #1
0
def doquit():
    # 手动清屏
    oledFunc.oledreset(oledaddress)
    time.sleep(0.1)
    # 确认退出信息
    oledFunc.oledstr(oledaddress, 0, 0, ' QUIT RPi RADIO ')
    oledFunc.oledstr(oledaddress, 3, 0, ' Are you sure ? ')
    oledFunc.oledstr(oledaddress, 6, 0, 'Press PLAY for Y')
    while True:
        irbutton = btn.readbutton()     # 接收按键
        # 向前按钮返回
        if irbutton == 'PREVIOUS':
            # 手动清屏
            oledFunc.oledreset(oledaddress)
            time.sleep(0.1)
            display()   # 显示主屏信息
            break       # 跳出返回主屏
        # 确认按钮退出
        if irbutton == 'PLAY':
            # 手动清屏
            oledFunc.oledreset(oledaddress)
            time.sleep(0.1)
            radioshutdown()     # 关闭RADIO
            quit()              # 退出程序
        time.sleep(0.2)
Example #2
0
def doquit():
    # 手动清屏
    oledFunc.oledreset(oledaddress)
    time.sleep(0.1)
    # 确认退出信息
    oledFunc.oledstr(oledaddress, 0, 0, ' QUIT RPi RADIO ')
    oledFunc.oledstr(oledaddress, 3, 0, ' Are you sure ? ')
    oledFunc.oledstr(oledaddress, 6, 0, 'Press PLAY for Y')
    while True:
        irbutton = btn.readbutton()  # 接收按键
        # 向前按钮返回
        if irbutton == 'PREVIOUS':
            # 手动清屏
            oledFunc.oledreset(oledaddress)
            time.sleep(0.1)
            display()  # 显示主屏信息
            break  # 跳出返回主屏
        # 确认按钮退出
        if irbutton == 'PLAY':
            # 手动清屏
            oledFunc.oledreset(oledaddress)
            time.sleep(0.1)
            radioshutdown()  # 关闭RADIO
            quit()  # 退出程序
        time.sleep(0.2)
Example #3
0
def showinfo():
    global flag_timing      # 定时关机时间
    global flag_shutdown    # 定时关机标志位
    global radio_timing
    flag = 0        # 菜单入口标志位
    flag_ok = 1     # 选择按钮
    flag_cls = 1    # 清屏标志位
    flag_disp = 1   # 主菜单显示标志位
    # 主菜单LIST
    distemp = ['1.CPU Temp  [  ]', '2.GPU Temp  [  ]', '3.Host Name [  ]', '4.Host IP   [  ]', '5.Wlan0 IP  [  ]',
               '6.Timehalt  [  ]', '7.Firmware  [  ]']
    # 手动清屏
    oledFunc.oledreset(oledaddress)
    time.sleep(0.1)

    while True:
        irbutton = btn.readbutton()     # 按键接收

        # 向前返回
        if irbutton == 'PREVIOUS':
            if flag == 0:               # 当前为主菜单
                # 手动清屏
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                display()   # 显示主屏信息
                break       # 跳出返回主屏
            elif flag != 0:     # 当前非主菜单
                flag = 0        # 返回主菜单
                flag_cls = 1    # 开启清屏
                flag_disp = 1   # 显示主菜单

        # 主菜单信息
        if flag == 0:
            if flag_cls:        # 清屏
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0    # 关闭清屏

            if irbutton == 'DOWN' and flag_ok < 7:      # 菜单向下选择
                flag_ok += 1        # 向下移动
                flag_disp = 1       # 开启主菜单更新
            if irbutton == 'UP' and flag_ok > 1:        # 菜单向上选择
                flag_ok -= 1        # 向上移动
                flag_disp = 1       # 开启主菜单更新
            if irbutton == 'PLAY':                      # 选择确认
                flag = flag_ok      # 根据确认位置跳转到对应目录
                flag_cls = 1        # 开启清屏
                #flag_disp = 1       # 开启主菜单更新

            if flag_disp:           # 主菜单信息显示
                flag_disp = 0       # 清标志位,关闭更新
                if flag_ok < 5:     # 前4行
                    oledFunc.oledstr(oledaddress, 0, 0, distemp[0])
                    oledFunc.oledstr(oledaddress, 2, 0, distemp[1])
                    oledFunc.oledstr(oledaddress, 4, 0, distemp[2])
                    oledFunc.oledstr(oledaddress, 6, 0, distemp[3])
                else:               # 后几行上移
                    oledFunc.oledstr(oledaddress, 0, 0, distemp[flag_ok - 4])
                    oledFunc.oledstr(oledaddress, 2, 0, distemp[flag_ok - 3])
                    oledFunc.oledstr(oledaddress, 4, 0, distemp[flag_ok - 2])
                    oledFunc.oledstr(oledaddress, 6, 0, distemp[flag_ok - 1])

                if flag_ok == 1:    # 选择按钮显示及移动
                    oledFunc.oledstr(oledaddress, 0, 104, 'OK')
                    oledFunc.oledstr(oledaddress, 0, 104, 'OK')
                    oledFunc.oledstr(oledaddress, 2, 104, '  ')
                    oledFunc.oledstr(oledaddress, 4, 104, '  ')
                    oledFunc.oledstr(oledaddress, 6, 104, '  ')
                elif flag_ok == 2:
                    oledFunc.oledstr(oledaddress, 0, 104, '  ')
                    oledFunc.oledstr(oledaddress, 2, 104, 'OK')
                    oledFunc.oledstr(oledaddress, 4, 104, '  ')
                    oledFunc.oledstr(oledaddress, 6, 104, '  ')
                elif flag_ok == 3:
                    oledFunc.oledstr(oledaddress, 0, 104, '  ')
                    oledFunc.oledstr(oledaddress, 2, 104, '  ')
                    oledFunc.oledstr(oledaddress, 4, 104, 'OK')
                    oledFunc.oledstr(oledaddress, 6, 104, '  ')
                else:
                    oledFunc.oledstr(oledaddress, 0, 104, '  ')
                    oledFunc.oledstr(oledaddress, 2, 104, '  ')
                    oledFunc.oledstr(oledaddress, 4, 104, '  ')
                    oledFunc.oledstr(oledaddress, 6, 104, 'OK')

        # (1)CPU温度信息
        elif flag == 1:
            # 读取CPU温度信息
            file = open("/sys/class/thermal/thermal_zone0/temp")
            # 读取结果,并转换为浮点数
            cpu_temp = float(file.read()) / 1000
            # 关闭文件
            file.close()
            if flag_cls:    # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0    # 关闭清屏
            # 显示CPU温度
            oledFunc.oledstr(oledaddress, 1, 0, 'CPU TEMPERATURE:')
            oledFunc.oledstr(oledaddress, 4, 42, str(cpu_temp))
            time.sleep(0.5)

        # (2)GPU温度信息
        elif flag == 2:
            # 读取GPU温度信息
            gpu_temp = commands.getoutput('/opt/vc/bin/vcgencmd measure_temp').replace('temp=', '').replace('\'C', '')
            if flag_cls:        # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0    # 关闭清屏
            # 显示GPU温度
            oledFunc.oledstr(oledaddress, 1, 0, 'GPU TEMPERATURE:')
            oledFunc.oledstr(oledaddress, 4, 50, str(gpu_temp))
            time.sleep(0.5)

        # (3)Host Name 信息
        elif flag == 3:
            if flag_cls:        # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0    # 关闭清屏
            oledFunc.oledstr(oledaddress, 1, 0, ' LOCALHOST NAME ')
            oledFunc.oledstr(oledaddress, 4, 20, socket.gethostname())
            time.sleep(0.5)

        # (4)HOST IP 地址
        elif flag == 4:
            if flag_cls:        # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0    # 关闭清屏
            oledFunc.oledstr(oledaddress, 1, 4, 'HOST IP ADDRESS')
            oledFunc.oledstr(oledaddress, 4, 28, socket.gethostbyname(socket.gethostname()))
            time.sleep(0.5)

        # (5)WLAN0 IP 地址
        elif flag == 5:
            if flag_cls:        # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0    # 关闭清屏
            # 获取WLAN0 IP 地址
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            oledFunc.oledstr(oledaddress, 1, 0, 'WLAN0 IP ADDRESS')
            oledFunc.oledstr(oledaddress, 4, 12,
                             socket.inet_ntoa(fcntl.ioctl(s.fileno(),
                                                          0x8915, struct.pack('256s', 'wlan0'[:15]))[20:24]))
            time.sleep(0.5)

        # (6)定时关机设置
        elif flag == 6:
            if flag_cls:        # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0    # 关闭清屏
            oledFunc.oledstr(oledaddress, 0, 0, 'Timing  Shutdown')

            # 设置关机时间
            if irbutton == 'UP' and flag_timing < 120:
                flag_timing += 10
            if irbutton == 'DOWN' and flag_timing > 10:
                flag_timing -= 10
            oledFunc.oledstr(oledaddress, 3, 40, str(flag_timing) + ' min  ')

            # 显示定时关机状态
            if flag_shutdown == 0:
                oledFunc.oledstr(oledaddress, 6, 0, 'Shutdown Not Set')
            if flag_shutdown == 1:
                oledFunc.oledstr(oledaddress, 6, 0, 'Shutdown ' + str(flag_timing) + ' min')

            if irbutton == 'PLAY':      # 确认设置
                # 手动清屏
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                if flag_shutdown == 0:      # 如果还未设置定时关机,进入设置
                    oledFunc.oledstr(oledaddress, 0, 0, ' Shutdown Setup ')
                    oledFunc.oledstr(oledaddress, 3, 0, ' Are you sure ? ')
                    oledFunc.oledstr(oledaddress, 6, 0, 'Press PLAY for Y')
                elif flag_shutdown == 1:    # 如果已经设置定时关机,进入取消
                    oledFunc.oledstr(oledaddress, 0, 0, ' Shutdown Cancel')
                    oledFunc.oledstr(oledaddress, 3, 0, ' Are you sure ? ')
                    oledFunc.oledstr(oledaddress, 6, 0, 'Press PLAY for Y')

                while True:
                    irbutton = btn.readbutton()

                    if flag_shutdown == 0:      # 如果还未设置定时关机,进入设置
                        if irbutton == 'PREVIOUS':      # 返回,不设置
                            # 手动清屏
                            oledFunc.oledreset(oledaddress)
                            time.sleep(0.1)
                            #flag_shutdown = 0
                            break
                        if irbutton == 'PLAY':          # 确认设置
                            os.system("sudo shutdown -h +" + str(flag_timing) + " &")
                            radio_timing = (flag_timing * 60 - 60) * 4      # 定时关闭RADIO
                            # 手动清屏
                            oledFunc.oledreset(oledaddress)
                            time.sleep(0.1)
                            flag_shutdown = 1           # 启动设置状态
                            break

                    if flag_shutdown == 1:      # 如果已经设置定时关机,进入取消
                        if irbutton == 'PREVIOUS':      # 返回,不取消
                            # 手动清屏
                            oledFunc.oledreset(oledaddress)
                            time.sleep(0.1)
                            #flag_shutdown = 1
                            break
                        if irbutton == 'PLAY':          # 确认取消
                            os.system("sudo shutdown -c")
                            # 手动清屏
                            oledFunc.oledreset(oledaddress)
                            time.sleep(0.1)
                            flag_shutdown = 0           # 启动未设置状态
                            break
                    time.sleep(0.2)

        # (7)固件版本信息
        elif flag == 7:
            if flag_cls:        # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0    # 关闭清屏
            oledFunc.oledstr(oledaddress, 0, 0, 'Firmware Version')
            oledFunc.oledstr(oledaddress, 3, 0, 'RasPi_RADIO_V1.0')
            oledFunc.oledstr(oledaddress, 6, 24, 'BY CHRONOS')
            time.sleep(0.5)
Example #4
0
        show_channel(ChannelWord.tang, ChannelWord.shan, ChannelWord.jiao, ChannelWord.tong,
                     ChannelWord.guang, ChannelWord.bo, ChannelWord.null, ChannelWord.null)
    elif 97.1 <= chan <= 97.3:        # 97.2天津新闻广播
        show_channel(ChannelWord.tian, ChannelWord.jin, ChannelWord.xin, ChannelWord.wen,
                     ChannelWord.guang, ChannelWord.bo, ChannelWord.null, ChannelWord.null)
    elif 97.3 <= chan <= 97.5:        # 97.4北京音乐广播
        show_channel(ChannelWord.bei, ChannelWord.jing, ChannelWord.yin, ChannelWord.yue,
                     ChannelWord.guang, ChannelWord.bo, ChannelWord.null, ChannelWord.null)
    elif 106.7 <= chan <= 106.9:        # 106.8天津交通广播
        show_channel(ChannelWord.tian, ChannelWord.jin, ChannelWord.jiao, ChannelWord.tong,
                     ChannelWord.guang, ChannelWord.bo, ChannelWord.null, ChannelWord.null)
    else:
        oledFunc.oledstr(oledaddress, 0, 0, 'Chronos RPiRadio')     # 显示标题

# OLED RESET
oledFunc.oledreset(oledaddress)
time.sleep(1)
# 启动屏显
oledFunc.oledstr(oledaddress, 3, 0, ' CHRONOS  RADIO ')
time.sleep(2)
# OLED RESET
oledFunc.oledreset(oledaddress)
time.sleep(0.5)

# RADIO RESET
radioreset()

# 显示主屏信息
display()
oledFunc.oledstr(oledaddress, 0, 0, 'Chronos RPiRadio')     # 显示标题
time.sleep(0.5)
Example #5
0
def showinfo():
    global flag_timing  # 定时关机时间
    global flag_shutdown  # 定时关机标志位
    global radio_timing
    flag = 0  # 菜单入口标志位
    flag_ok = 1  # 选择按钮
    flag_cls = 1  # 清屏标志位
    flag_disp = 1  # 主菜单显示标志位
    # 主菜单LIST
    distemp = [
        '1.CPU Temp  [  ]', '2.GPU Temp  [  ]', '3.Host Name [  ]',
        '4.Host IP   [  ]', '5.Wlan0 IP  [  ]', '6.Timehalt  [  ]',
        '7.Firmware  [  ]'
    ]
    # 手动清屏
    oledFunc.oledreset(oledaddress)
    time.sleep(0.1)

    while True:
        irbutton = btn.readbutton()  # 按键接收

        # 向前返回
        if irbutton == 'PREVIOUS':
            if flag == 0:  # 当前为主菜单
                # 手动清屏
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                display()  # 显示主屏信息
                break  # 跳出返回主屏
            elif flag != 0:  # 当前非主菜单
                flag = 0  # 返回主菜单
                flag_cls = 1  # 开启清屏
                flag_disp = 1  # 显示主菜单

        # 主菜单信息
        if flag == 0:
            if flag_cls:  # 清屏
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0  # 关闭清屏

            if irbutton == 'DOWN' and flag_ok < 7:  # 菜单向下选择
                flag_ok += 1  # 向下移动
                flag_disp = 1  # 开启主菜单更新
            if irbutton == 'UP' and flag_ok > 1:  # 菜单向上选择
                flag_ok -= 1  # 向上移动
                flag_disp = 1  # 开启主菜单更新
            if irbutton == 'PLAY':  # 选择确认
                flag = flag_ok  # 根据确认位置跳转到对应目录
                flag_cls = 1  # 开启清屏
                #flag_disp = 1       # 开启主菜单更新

            if flag_disp:  # 主菜单信息显示
                flag_disp = 0  # 清标志位,关闭更新
                if flag_ok < 5:  # 前4行
                    oledFunc.oledstr(oledaddress, 0, 0, distemp[0])
                    oledFunc.oledstr(oledaddress, 2, 0, distemp[1])
                    oledFunc.oledstr(oledaddress, 4, 0, distemp[2])
                    oledFunc.oledstr(oledaddress, 6, 0, distemp[3])
                else:  # 后几行上移
                    oledFunc.oledstr(oledaddress, 0, 0, distemp[flag_ok - 4])
                    oledFunc.oledstr(oledaddress, 2, 0, distemp[flag_ok - 3])
                    oledFunc.oledstr(oledaddress, 4, 0, distemp[flag_ok - 2])
                    oledFunc.oledstr(oledaddress, 6, 0, distemp[flag_ok - 1])

                if flag_ok == 1:  # 选择按钮显示及移动
                    oledFunc.oledstr(oledaddress, 0, 104, 'OK')
                    oledFunc.oledstr(oledaddress, 0, 104, 'OK')
                    oledFunc.oledstr(oledaddress, 2, 104, '  ')
                    oledFunc.oledstr(oledaddress, 4, 104, '  ')
                    oledFunc.oledstr(oledaddress, 6, 104, '  ')
                elif flag_ok == 2:
                    oledFunc.oledstr(oledaddress, 0, 104, '  ')
                    oledFunc.oledstr(oledaddress, 2, 104, 'OK')
                    oledFunc.oledstr(oledaddress, 4, 104, '  ')
                    oledFunc.oledstr(oledaddress, 6, 104, '  ')
                elif flag_ok == 3:
                    oledFunc.oledstr(oledaddress, 0, 104, '  ')
                    oledFunc.oledstr(oledaddress, 2, 104, '  ')
                    oledFunc.oledstr(oledaddress, 4, 104, 'OK')
                    oledFunc.oledstr(oledaddress, 6, 104, '  ')
                else:
                    oledFunc.oledstr(oledaddress, 0, 104, '  ')
                    oledFunc.oledstr(oledaddress, 2, 104, '  ')
                    oledFunc.oledstr(oledaddress, 4, 104, '  ')
                    oledFunc.oledstr(oledaddress, 6, 104, 'OK')

        # (1)CPU温度信息
        elif flag == 1:
            # 读取CPU温度信息
            file = open("/sys/class/thermal/thermal_zone0/temp")
            # 读取结果,并转换为浮点数
            cpu_temp = float(file.read()) / 1000
            # 关闭文件
            file.close()
            if flag_cls:  # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0  # 关闭清屏
            # 显示CPU温度
            oledFunc.oledstr(oledaddress, 1, 0, 'CPU TEMPERATURE:')
            oledFunc.oledstr(oledaddress, 4, 42, str(cpu_temp))
            time.sleep(0.5)

        # (2)GPU温度信息
        elif flag == 2:
            # 读取GPU温度信息
            gpu_temp = commands.getoutput(
                '/opt/vc/bin/vcgencmd measure_temp').replace('temp=',
                                                             '').replace(
                                                                 '\'C', '')
            if flag_cls:  # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0  # 关闭清屏
            # 显示GPU温度
            oledFunc.oledstr(oledaddress, 1, 0, 'GPU TEMPERATURE:')
            oledFunc.oledstr(oledaddress, 4, 50, str(gpu_temp))
            time.sleep(0.5)

        # (3)Host Name 信息
        elif flag == 3:
            if flag_cls:  # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0  # 关闭清屏
            oledFunc.oledstr(oledaddress, 1, 0, ' LOCALHOST NAME ')
            oledFunc.oledstr(oledaddress, 4, 20, socket.gethostname())
            time.sleep(0.5)

        # (4)HOST IP 地址
        elif flag == 4:
            if flag_cls:  # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0  # 关闭清屏
            oledFunc.oledstr(oledaddress, 1, 4, 'HOST IP ADDRESS')
            oledFunc.oledstr(oledaddress, 4, 28,
                             socket.gethostbyname(socket.gethostname()))
            time.sleep(0.5)

        # (5)WLAN0 IP 地址
        elif flag == 5:
            if flag_cls:  # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0  # 关闭清屏
            # 获取WLAN0 IP 地址
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            oledFunc.oledstr(oledaddress, 1, 0, 'WLAN0 IP ADDRESS')
            oledFunc.oledstr(
                oledaddress, 4, 12,
                socket.inet_ntoa(
                    fcntl.ioctl(s.fileno(), 0x8915,
                                struct.pack('256s', 'wlan0'[:15]))[20:24]))
            time.sleep(0.5)

        # (6)定时关机设置
        elif flag == 6:
            if flag_cls:  # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0  # 关闭清屏
            oledFunc.oledstr(oledaddress, 0, 0, 'Timing  Shutdown')

            # 设置关机时间
            if irbutton == 'UP' and flag_timing < 120:
                flag_timing += 10
            if irbutton == 'DOWN' and flag_timing > 10:
                flag_timing -= 10
            oledFunc.oledstr(oledaddress, 3, 40, str(flag_timing) + ' min  ')

            # 显示定时关机状态
            if flag_shutdown == 0:
                oledFunc.oledstr(oledaddress, 6, 0, 'Shutdown Not Set')
            if flag_shutdown == 1:
                oledFunc.oledstr(oledaddress, 6, 0,
                                 'Shutdown ' + str(flag_timing) + ' min')

            if irbutton == 'PLAY':  # 确认设置
                # 手动清屏
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                if flag_shutdown == 0:  # 如果还未设置定时关机,进入设置
                    oledFunc.oledstr(oledaddress, 0, 0, ' Shutdown Setup ')
                    oledFunc.oledstr(oledaddress, 3, 0, ' Are you sure ? ')
                    oledFunc.oledstr(oledaddress, 6, 0, 'Press PLAY for Y')
                elif flag_shutdown == 1:  # 如果已经设置定时关机,进入取消
                    oledFunc.oledstr(oledaddress, 0, 0, ' Shutdown Cancel')
                    oledFunc.oledstr(oledaddress, 3, 0, ' Are you sure ? ')
                    oledFunc.oledstr(oledaddress, 6, 0, 'Press PLAY for Y')

                while True:
                    irbutton = btn.readbutton()

                    if flag_shutdown == 0:  # 如果还未设置定时关机,进入设置
                        if irbutton == 'PREVIOUS':  # 返回,不设置
                            # 手动清屏
                            oledFunc.oledreset(oledaddress)
                            time.sleep(0.1)
                            #flag_shutdown = 0
                            break
                        if irbutton == 'PLAY':  # 确认设置
                            os.system("sudo shutdown -h +" + str(flag_timing) +
                                      " &")
                            radio_timing = (flag_timing * 60 -
                                            60) * 4  # 定时关闭RADIO
                            # 手动清屏
                            oledFunc.oledreset(oledaddress)
                            time.sleep(0.1)
                            flag_shutdown = 1  # 启动设置状态
                            break

                    if flag_shutdown == 1:  # 如果已经设置定时关机,进入取消
                        if irbutton == 'PREVIOUS':  # 返回,不取消
                            # 手动清屏
                            oledFunc.oledreset(oledaddress)
                            time.sleep(0.1)
                            #flag_shutdown = 1
                            break
                        if irbutton == 'PLAY':  # 确认取消
                            os.system("sudo shutdown -c")
                            # 手动清屏
                            oledFunc.oledreset(oledaddress)
                            time.sleep(0.1)
                            flag_shutdown = 0  # 启动未设置状态
                            break
                    time.sleep(0.2)

        # (7)固件版本信息
        elif flag == 7:
            if flag_cls:  # 清主菜单屏幕
                oledFunc.oledreset(oledaddress)
                time.sleep(0.1)
                flag_cls = 0  # 关闭清屏
            oledFunc.oledstr(oledaddress, 0, 0, 'Firmware Version')
            oledFunc.oledstr(oledaddress, 3, 0, 'RasPi_RADIO_V1.0')
            oledFunc.oledstr(oledaddress, 6, 24, 'BY CHRONOS')
            time.sleep(0.5)
Example #6
0
                     ChannelWord.wen, ChannelWord.guang, ChannelWord.bo,
                     ChannelWord.null, ChannelWord.null)
    elif 97.3 <= chan <= 97.5:  # 97.4北京音乐广播
        show_channel(ChannelWord.bei, ChannelWord.jing, ChannelWord.yin,
                     ChannelWord.yue, ChannelWord.guang, ChannelWord.bo,
                     ChannelWord.null, ChannelWord.null)
    elif 106.7 <= chan <= 106.9:  # 106.8天津交通广播
        show_channel(ChannelWord.tian, ChannelWord.jin, ChannelWord.jiao,
                     ChannelWord.tong, ChannelWord.guang, ChannelWord.bo,
                     ChannelWord.null, ChannelWord.null)
    else:
        oledFunc.oledstr(oledaddress, 0, 0, 'Chronos RPiRadio')  # 显示标题


# OLED RESET
oledFunc.oledreset(oledaddress)
time.sleep(1)
# 启动屏显
oledFunc.oledstr(oledaddress, 3, 0, ' CHRONOS  RADIO ')
time.sleep(2)
# OLED RESET
oledFunc.oledreset(oledaddress)
time.sleep(0.5)

# RADIO RESET
radioreset()

# 显示主屏信息
display()
oledFunc.oledstr(oledaddress, 0, 0, 'Chronos RPiRadio')  # 显示标题
time.sleep(0.5)