Go to advanced search

by Paeryn
Mon Jun 24, 2019 10:03 pm
Forum: C/C++
Topic: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals
Replies: 11
Views: 478

Re: What is the correct way to use /dev/gpiomem with mmap to get access to Raspberry PI3 peripherals

I believe also by default WiringPi doesn't use /dev/gpiomem it uses the Linux kernel interface and uses /sys/class/gpio/gpio## that might be why you don't see any conflicts. No! Take a look at WiringPi sources. It tries /dev/mem first and, if the user is not running as root, it uses /dev/gpiomem . ...
by Paeryn
Sun Jun 23, 2019 3:11 am
Forum: Other programming languages
Topic: ScriptBasic
Replies: 1188
Views: 32227

Re: ScriptBasic

The change was minor so I'll push it and give you credit for the fix. git push -o merge_request.create Docs Thanks. That's different to how GitHub does Pull Requests, or at least is not a way that I have seen before (not that I know much about git, I only used it when I need to). Didn't even know i...
by Paeryn
Sat Jun 22, 2019 11:51 pm
Forum: Other programming languages
Topic: ScriptBasic
Replies: 1188
Views: 32227

Re: ScriptBasic

The sandbox repo allows submitting merge requests if you feel you nailed it. AIR approves all merge requests so give him a heads up what your.submitting. Not sure how to do this to the sandbox repo, I've only ever used GitHub for uploading repos and I don't want to copy it to there since that isn't...
by Paeryn
Sat Jun 22, 2019 4:14 am
Forum: Other programming languages
Topic: ScriptBasic
Replies: 1188
Views: 32227

Re: ScriptBasic

From what I could see that is all that was needed, I'll check later to make sure pszModuleError is initialised to NULL before any error can be raised. But for now, to quote the great Zebedee, "Time for bed".
by Paeryn
Sat Jun 22, 2019 2:45 am
Forum: Other programming languages
Topic: ScriptBasic
Replies: 1188
Views: 32227

Re: ScriptBasic

Back to raising errors. It appears that returning a number from the interface routines will cause an error to be raised. If that number is the value of a known error then the appropriate error message will be reported. Other values indicate an extension specific error. A value of 0x81001 does that ...
by Paeryn
Fri Jun 21, 2019 1:14 pm
Forum: Python
Topic: increase speed for "count in range"
Replies: 3
Views: 228

Re: increase speed for "count in range"

You do realise that your loop, as you have it, will only have one iteration. count will only have the value 0 so the else part of the if won't be executed. Python's range() is in clusive of the start value but ex clusive of the end value. range(0, 1) = [0] range(0, 2) = [0, 1] for count in range(0,1...
by Paeryn
Fri Jun 21, 2019 10:16 am
Forum: Python
Topic: Loop Trouble(s)
Replies: 3
Views: 188

Re: Loop Trouble(s)

The primary purpose of this script is to call the sh file "print" which resides in another directory when a GPIO button is pressed. The secondary function is to display instructions and feedback on a 16x2 LCD. When the script loads the LCD displays "READY" as expected. When the button is pressed th...
by Paeryn
Fri Jun 21, 2019 9:36 am
Forum: Troubleshooting
Topic: kernel Oops 5
Replies: 5
Views: 174

Re: kernel Oops 5

Hmm, is it in /var/log/kern.log ?
by Paeryn
Thu Jun 20, 2019 10:37 pm
Forum: Troubleshooting
Topic: kernel Oops 5
Replies: 5
Views: 174

Re: kernel Oops 5

There should be more information in the logs than just that line, there should be a few lines before it giving more information and a load of lines after giving a dump of the processor state and a memory dump of (part of) the stack at the time the error happened. I think they are in /var/log/message...
by Paeryn
Thu Jun 20, 2019 2:02 am
Forum: C/C++
Topic: how to use pthread_kill(pthread_t tid, int sig) by which sig ?
Replies: 22
Views: 643

Re: how to use pthread_kill(pthread_t tid, int sig) by which sig ?

heya, as to // We pass in a pointer to the thread id which we may need to cancel void* WATCHER_thr(void* heartbeat_id) // thread watcher 1 question about what I do not understand yet: why do have to pass a different (special, arbitrary) thread pointer? Finally the thread which is missing to send th...
by Paeryn
Tue Jun 18, 2019 11:14 pm
Forum: Python
Topic: Problem with function set_background or set_material in pi3d
Replies: 3
Views: 199

Re: Problem with function set_background or set_material in pi3d

Hello. When you change the color value of the class Display noticed that this class uses an octabit color representation instead of 256. That is, 000; 001; ... 111. I wanted to ask if it should be so, or is there another way to change the color Display using 256 submissions (rgb or hex)? By the way...
by Paeryn
Tue Jun 18, 2019 2:38 pm
Forum: C/C++
Topic: how to use pthread_kill(pthread_t tid, int sig) by which sig ?
Replies: 22
Views: 643

Re: how to use pthread_kill(pthread_t tid, int sig) by which sig ?

Just be careful with asynchronous cancels, there's no telling what the thread was doing when the cancel happens. Your cleanup functions should attempt to release any resources they have (file handles, allocated memory etc.) but if the thread got itself into a state where you aren't in control of it ...
by Paeryn
Tue Jun 18, 2019 1:22 pm
Forum: C/C++
Topic: how to use pthread_kill(pthread_t tid, int sig) by which sig ?
Replies: 22
Views: 643

Re: how to use pthread_kill(pthread_t tid, int sig) by which sig ?

I've added some example code to what you gave which will allow the watcher thread to cancel the uart thread. I had to change the order of starting the threads as the watcher thread needs the id of the uart thread. The pthread_cleanup_push() and pthread_cleanup_pop() functions are actually macros in ...
by Paeryn
Tue Jun 18, 2019 12:01 am
Forum: C/C++
Topic: how to use pthread_kill(pthread_t tid, int sig) by which sig ?
Replies: 22
Views: 643

Re: how to use pthread_kill(pthread_t tid, int sig) by which sig ?

Yes, I had a bad feeling it would do that. You probably should try a different signal (such as SIGTERM), catch it in the thread, and get the thread to terminate itself. SIGTERM will terminate the process as a whole as well. You might be able to use pthread_cancel(thread_id); That requests a thread ...
by Paeryn
Sat Jun 15, 2019 3:50 pm
Forum: C/C++
Topic: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?
Replies: 13
Views: 534

Re: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?

It should swap between them, the locked up one would ultimately prevent any lower priority thread from being run though. Again, it's a rough approximation of what happens, and with multi-core setups you have as many threads active as there are cores and threads will usually try to be kept on the sam...
by Paeryn
Sat Jun 15, 2019 12:20 am
Forum: C/C++
Topic: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?
Replies: 13
Views: 534

Re: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?

thank you for your hints and advices! As long as the higher priority thread doesn't continuously work (e.g. it sleeps or waits on other events) then you are ok, but if your priority 50 thread sits in a loop working 100% then any threads with a priority of less than 50 won't get a look in. but IIUC,...
by Paeryn
Thu Jun 13, 2019 8:50 pm
Forum: C/C++
Topic: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?
Replies: 13
Views: 534

Re: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?

PS, forgotten to ask...: if my pthreads have e.g. SCHED_RR prio=50 : which prio has a perpetual loop in main()? If a pthread by prio=50 hangs up completely, will it block then the main loop, too? And will a 2nd thread by prio=30 then also be blocked totally? int main() { // threads pthread_t thread...
by Paeryn
Thu Jun 13, 2019 2:10 am
Forum: C/C++
Topic: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?
Replies: 13
Views: 534

Re: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?

I'm not sure how threads at the same priority but with different schedulers are ordered with respect to others. All threads at pri=40 sched_rr will get equal run time (when the first finishes it goes to the back of its queue) but I don't know how it decides between a pri=40 sched_fifo thread and a p...
by Paeryn
Wed Jun 12, 2019 10:42 pm
Forum: C/C++
Topic: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?
Replies: 13
Views: 534

Re: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?

Normal user threads are scheduled with SCHED_OTHER and have a priority of 0 and a nice level between -20 and +19, the default nice level is 0. The higher its niceness is the lower its priority is, so a process with a niceness of 19 has the lowest priority. Only SCHED_OTHER uses the niceness level an...
by Paeryn
Tue Jun 11, 2019 11:40 pm
Forum: General programming discussion
Topic: A Final Fibonacci Challenge
Replies: 601
Views: 18054

Re: A Final Fibonacci Challenge

I'm still getting seg faults trying to run the code. Can the C pros on this thread have a peek and help me figure out what the problem is or the best way to debug it? It gets to the first GMP::BI_ADD() function and seg faults. The original fibo function AIR helped out with works. My guess is SB doe...
by Paeryn
Tue Jun 11, 2019 9:52 pm
Forum: Python
Topic: How to print without newline
Replies: 6
Views: 291

Re: How to print without newline

Or use the fact that two string literals with only whitespace between them are implicitly converted into a single string at compile time rather than at run time (and you can use different quotation marks for each part if you want). $ cat strings.py print("This string is entered in two parts on separ...
by Paeryn
Tue Jun 11, 2019 8:05 pm
Forum: OpenGLES
Topic: undefined reference to BlendFuncSeparateOES
Replies: 5
Views: 535

Re: undefined reference to BlendFuncSeparateOES

At a guess, the driver (that is the one running on the VC4) doesn't support separate blend modes for alpha when running in an ES1 context. There's nothing preventing the hardware from doing it as blending is done in software on the QPUs but the driver that generates QPU code for ES1 might assume the...
by Paeryn
Tue Jun 11, 2019 5:27 pm
Forum: General programming discussion
Topic: A Final Fibonacci Challenge
Replies: 601
Views: 18054

Re: A Final Fibonacci Challenge

There'll be leaks abound due to code like this res = mulis(fk, subis(mulis(fk1, "2"), fk)); Where the inner mulis allocates a string for the result which is passed to subis, when subis returns nobody has freed the string and its address is lost. Same with the string that subis returns and passes to ...
by Paeryn
Mon Jun 10, 2019 1:01 am
Forum: General programming discussion
Topic: A Final Fibonacci Challenge
Replies: 601
Views: 18054

Re: A Final Fibonacci Challenge

On my mobile phone (Android 7.1.1 with the default Chrome browser) I obtain the text The 4784969th Fibonacci Number is: Calculator:Preparing... (0/1) Sometimes nothing further happens; sometimes the big number appears after a few minutes. If I try to scroll to see the number, it disappears leaving ...
by Paeryn
Sat Jun 08, 2019 11:21 pm
Forum: C/C++
Topic: Weird artifacts on dot matrix display
Replies: 8
Views: 418

Re: Weird artifacts on dot matrix display

steven1578 wrote:
Sat Jun 08, 2019 9:28 pm
The problem however is shown in the video:
https://www.youtube.com/watch?v=8G8Ydv_b1eE
Could you describe what the problem is as, according to youtube, This video is unavailable?

Go to advanced search