wguerlich / RFSwitch

Interface TI CC1101 based transceivers with cloud based services. Runs on Raspberry Pi and other boards with a SPI interface.
MIT License
1 stars 0 forks source link

High CPU Load #2

Open thmang82 opened 6 years ago

thmang82 commented 6 years ago

Hi there, while using your decode code to write a node server running RFSwitch, I discovered with top that RFSwitch is using 50% CPU on my Pi Zero W.

Any chance to reduce the CPU usage?

I am not familiar with Go, so no idea if this is solely related to SPI, or if there is any way you can insert some tiny wait or so in the Go code ...

thmang82 commented 6 years ago

I found a way to reduce the CPU load a bit:

in radio.go in mainLoop() add the following just before "} else if status == 0x60 {": time.Sleep(7 * time.Millisecond)

The line will let the main loop that process the data sleep a bit after every data processing (in case status == 0x10)

This are the tested settings: