Skip to content

Commit

Permalink
Update util.rb
Browse files Browse the repository at this point in the history
Remove references to Raspberry Pi 1, and update default_sched_ahead times for Pi2 and Pi3 models
  • Loading branch information
rbnpi authored Jan 30, 2021
1 parent fc613be commit 35b89c2
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions app/server/ruby/lib/sonicpi/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ module Util
@@current_uuid = nil
@@home_dir = nil
@@util_lock = Mutex.new
@@raspberry_pi_1 = RUBY_PLATFORM.match(/.*arm.*-linux.*/) && File.exist?('/proc/cpuinfo') && !(`cat /proc/cpuinfo | grep BCM2708`).empty?
@@raspberry_pi_2 = RUBY_PLATFORM.match(/.*arm.*-linux.*/) && ['a01040','a01041','a22042'].include?(`awk '/^Revision/ { print $3}' /proc/cpuinfo`.delete!("\n"))
@@raspberry_pi_3 = RUBY_PLATFORM.match(/.*arm.*-linux.*/) && ['a02082','a22082','a32082'].include?(`awk '/^Revision/ { print $3}' /proc/cpuinfo`.delete!("\n"))
@@raspberry_pi_3bplus = RUBY_PLATFORM.match(/.*arm.*-linux.*/) && ['a020d3'].include?(`awk '/^Revision/ { print $3}' /proc/cpuinfo`.delete!("\n"))
Expand Down Expand Up @@ -118,10 +117,6 @@ def raspberry_pi?
os == :raspberry
end

def raspberry_pi_1?
os == :raspberry && @@raspberry_pi_1
end

def raspberry_pi_2?
os == :raspberry && @@raspberry_pi_2
end
Expand Down Expand Up @@ -195,17 +190,15 @@ def num_buffers_for_current_os
end

def num_audio_busses_for_current_os
if os == :raspberry && @@raspberry_pi_1
64
else
1024
end

end

def default_sched_ahead_time
if raspberry_pi_1?
1
if raspberry_pi_2?
2
elsif raspberry_pi_3? or raspberry_pi_3bplus? \
or raspberry_pi_3_64? or raspberry_pi_3bplus_64?
1.5
else
0.5
end
Expand All @@ -214,9 +207,7 @@ def default_sched_ahead_time
def host_platform_desc
case os
when :raspberry
if raspberry_pi_1?
"Raspberry Pi 1"
elsif raspberry_pi_2?
if raspberry_pi_2?
"Raspberry Pi 2B"
elsif raspberry_pi_3?
"Raspberry Pi 3B"
Expand Down Expand Up @@ -260,11 +251,7 @@ def host_platform_desc

def default_control_delta
if raspberry_pi?
if raspberry_pi_1?
0.02
else
0.013
end
else
0.005
end
Expand Down

0 comments on commit 35b89c2

Please sign in to comment.