i have arranged connection between cm (on cmio) , pitft 2.8". works!
think it's slow. tried 4 buttons example code here: if touch buttons fast, see on console touch correctly detected, sometime button doesn't show "pressed" status (the background should changes).
after tests found instruction pygame.display.update(), refresh of pixels, takes 30ms (62.5mhz spi speed)-55ms (31.2mhz spi speed). 62.5mhz can't used, because screen refresh wrong pixel data (i don't know if it's problem of cpu isn't capable of running spi @ speed or display controller can't manage commands @ speed).
@ 45mhz spi clock speed, pygame.display.update() takes 40ms (measured oscilloscope). it's theorical frame rate of 25 fps. in real situations, think can reach 10-15 fps.
isn't low? how have better performance?
think it's slow. tried 4 buttons example code here:
code: select all
import pygame import os import pygameui ui import logging import rpi.gpio gpio #setup gpios outputs - 4 , 17 available gpio.setmode(gpio.bcm) gpio.setup(4, gpio.out) gpio.setup(17, gpio.out) log_format = '%(asctime)-6s: %(name)s - %(levelname)s - %(message)s' console_handler = logging.streamhandler() console_handler.setformatter(logging.formatter(log_format)) logger = logging.getlogger() logger.setlevel(logging.debug) logger.addhandler(console_handler) os.putenv('sdl_fbdev', '/dev/fb1') os.putenv('sdl_mousedrv', 'tslib') os.putenv('sdl_mousedev', '/dev/input/touchscreen') margin = 20 class pitft(ui.scene): def __init__(self): ui.scene.__init__(self) self.on17_button = ui.button(ui.rect(margin, margin, 130, 90), '17 on') self.on17_button.on_clicked.connect(self.gpi_button) self.add_child(self.on17_button) self.on4_button = ui.button(ui.rect(170, margin, 130, 90), '4 on') self.on4_button.on_clicked.connect(self.gpi_button) self.add_child(self.on4_button) self.off17_button = ui.button(ui.rect(margin, 130, 130, 90), '17 off') self.off17_button.on_clicked.connect(self.gpi_button) self.add_child(self.off17_button) self.off4_button = ui.button(ui.rect(170, 130, 130, 90), '4 off') self.off4_button.on_clicked.connect(self.gpi_button) self.add_child(self.off4_button) def gpi_button(self, btn, mbtn): logger.info(btn.text) if btn.text == '17 on': gpio.output(17, false) elif btn.text == '4 on': gpio.output(4, false) elif btn.text == '17 off': gpio.output(17, true) elif btn.text == '4 off': gpio.output(4, true) ui.init('raspberry pi ui', (320, 240)) pygame.mouse.set_visible(false) ui.scene.push(pitft()) ui.run()
after tests found instruction pygame.display.update(), refresh of pixels, takes 30ms (62.5mhz spi speed)-55ms (31.2mhz spi speed). 62.5mhz can't used, because screen refresh wrong pixel data (i don't know if it's problem of cpu isn't capable of running spi @ speed or display controller can't manage commands @ speed).
@ 45mhz spi clock speed, pygame.display.update() takes 40ms (measured oscilloscope). it's theorical frame rate of 25 fps. in real situations, think can reach 10-15 fps.
isn't low? how have better performance?
hi,
noticed pygameui slow. not sure it's due pygame, pygameui, or code.
started playing example code , come https://github.com/optio/piradio . it's simple internet radio front-end using mpc, not supposed using cpu using pygame, though renders @ 8 fps on pi3
using buttons laggy, 'pressed' state shown
noticed pygameui slow. not sure it's due pygame, pygameui, or code.
started playing example code , come https://github.com/optio/piradio . it's simple internet radio front-end using mpc, not supposed using cpu using pygame, though renders @ 8 fps on pi3
using buttons laggy, 'pressed' state shown
raspberrypi
Comments
Post a Comment