Raspberry Pi: PiTFT-display touch stops working after some touches - raspberry-pi

I use a Raspberry Pi and the PiTFT display for a program with kivy. In the program you can start a process and amongst other things you can then pause or stop it. Clicking "Pause" will lead to the button saying "Continue". Now when you click "Pause" and then without continuing "Stop", something weird happens: The touchscreen stops working. You can't click any more buttons, neither in my program nor in any other.
I know you might think it has to be something in my code, but I promise it's not. The process does things in a while loop over and over again which contains another while loop that is only executed if the value 'paused' is not set. And it works fine on my laptop. Also: There are two versions of the program. One reading values from an AD-converter connected to the pins and one just generating random values instead. And the one with the random numbers does not have this problem. So it's really not about the code..
Sometimes it happens that after like 2 minutes suddenly the "Start"-button that I pressed the 2 minutes ago is reacting again. So it somehow seems as if there's just a huge delay. It then works fine again until you do the "Pause" -> "Stop" thing.
The last weird thing is that when I reboot, the touchscreen is not working at all, not even at the beginning. And also not after a few minutes, there's no delay. It always works again after the second reboot.
So I really don't know where this is coming from. The only difference is the AD-converter-part, but that worked fine before. I used the device for months and this is just happening now. And it's so weird that not the program crashes but the whole touchscreen.. even after the reboot.
I also tried another Pi, but it gives me the same problem.
Does anyone have an idea what I can do?

Any chance you see a tiny little rainbow square in the upper right?
The Pi uses it to indicate that you're drawing too much power.
Since TFTs are normally powered directly from the Pi, it stands to reason that if you're putting extra load on the system while already using a TFT, it could be enough to push it over the edge.

Related

Lag when exporting functionality into a block in Scratch

I'm new to scratch.
I have this code within a sprite, which works as expected without noticeable lags:
But, when I "export" the flickering into the 'flicker' block, it has a very nasty lag:
I created a special sprite in order to easily "feel" the lag, with this code:
This ball smoothly moves, until (every 5 seconds) there is the flickering effect and it stops for 1 second or so.
Can anyone give me a clue why it happens, and how to prevent it?
The project page is here.
Any assistance would be appreciated.
Let me start by pointing out that the problem does not occur when I launch your project.
I tried it in 5 different web browsers on 3 different devices with 2 different operating systems, and every time, the ball just kept moving.
However, I can make such an issue happen by enabling 'Run without screen refresh' in the 'flicker' block, as follows:
Right-click on the red 'define flicker' block.
From the context menu, select 'Edit'.
In the 'make a block' dialog, turn on checkbox 'Run without screen refresh', then click OK.
I suspect 'Run without screen refresh' claims all processing power, effectively blocking any other (concurrent) scripts.
My guess is, you already fixed the problem yourself by turning off 'Run without screen refresh'.
In general, 'Run without screen refresh' is a great way to reduce lag in scripts where speed is essential. But never use it in a script with 'wait' or 'forever' blocks, or it will cause lag.

Eclipse closes all shells when one is closed

I've a project which is a randomizer. The randomizer gives a random number (of course) which is used to call a random game.
For now, I only have one game.
When I run the randomizer to get the game, everything works and it loads the game flawlessly.
But, when I close the window which was created for the random game, it also closes the parent window which gives the user access to the randomizer.
I am not sure as to why this is happening.
I tried refactoring the name of my shell as well as my display, wondering if this closing was occurring because they shared names, but that didn't fix anything.
I'm not sure why this is happening or what code would prevent this from happening.
Any thoughts would be much appreciated!
Thanks!
Nathan
The issue was that there was a JFrame invoking frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);. This was forcing all windows closed. Turning this off fixed the issue.

iOS - App is using a lot of CPU while seemingly not doing anything

When I run my app in Xcode, xcode tells me it is constantly 35% of the CPU, even though it appears that nothing is happening. Nothing is suppose to be happening, so I am surprised by the CPU usage. There is obviously a loop in the code, but I need to figure out how to locate it.
I'm trying to figure out how to locate the loop, perhaps using instruments, but I don't really know where to begin.
Does anyone have any advice on how to attack this problem? I have hit the "pause" button in Xcode, but it of course pauses on the compiled stack (or whatever that screen with a bunch of Hex values is called).
Thanks!

CCRepeatForever not resuming immediately after sleep

In a cocos2D powered iphone app, I use the CCRepeatForever action to make the background pass by. It works fine when I debug the app (build and run via XCode). Even if I quit the app and resume it, no problem.
However when I bundle the app into an .ipa for beta testing I get a weird problem :
At launch the background passes by nicely. But if I quit the app and resume the game later, the app takes me back where I left it, with everything working but the moving background. And after a time (roughly proportional to the time since I quitted the app) the background starts moving again as it should, without me doing anything particular.
Is this a know issue ?
Thanks
OH, I had a very similar problem a little while ago. I would pause the game, then on resume nothing would happen, then it would suddenly jump and I'd be swarmed with monsters.
I can't tell you precisely where to look, but here's what I was doing:
I had a timer that was not using the (ccTime)dt to calculate time, but was using an NSDate timestamp. The problem was that I had an event to be scheduled at a certain time based on the date, but was using the dt to figure out when to trigger the event.
As far as I could tell, pausing the game was halting the scheduled events, so the "dt" wasn't incrementing at all, but the system clock kept ticking, so what ended up happening is that I would pause for say 10 seconds, the system clock ticked up and triggered, but the "dt" was adding into a float timeElapsed, and until that caught up, nothing happened.
What you probably need to look for is something inside a scheduled event that is using an NSDate or a unix timestamp or the iPad/iPod system clock. When you halt the simulator, the system clock doesn't seem to run the same way it does on an actual iPad.
Sorry, I don't know EXACTLY how this stuff works, but I also went through an agonizing time with a similar problem and it was based on the system timer. Just make sure you're pausing everything with the CCDirector properly and make sure you're not using any system clock stuff for game timing

Placeholder strange behavior on input

I'm programming an application for iPhone. My application has a login system. In the login system (and somewhere around my app) I have some placeholder in the UITextFields.
After a couple of months working on this app, I noticed a sudden problem that arose once. If I don't write in the text fields that have placeholders nothing happens, if I write something in them, the blue bar that blinks showing where you are in the text becomes very slow. Moreover the ScrollViews that I have become EXTREMELY slow. Some other strange behavior happens when I have a wheel that lets the user pick some choice: the options of the wheel "fall" from the sky while the user rolls it.
All of this happens only if I write something in a UITextField that has some placeholder. If not, nothing of this happens.
I know this sounds REALLY strange, I used a MacOSX program to create a video of the text field becoming slow.
It's .swf.
try to do one thing.. delete this textfiled and create a new one with different name and see is this problem occurring again? also try to set breakpoints in your code and debug your code.
Are you sure you aren't leaking any memory or running an endless loop on the cpu? Try monitoring your app with Instruments and check your cpu activity and memory allocations.