mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
raspberrypi (all variants): add (none) overclocking setting
This commit is contained in:
parent
2a2643faaa
commit
c06442ccee
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from config import additional_config
|
from config import additional_config
|
||||||
|
|
||||||
@ -54,27 +53,13 @@ OVERCLOCK = {
|
|||||||
800: '800|250|400|0',
|
800: '800|250|400|0',
|
||||||
900: '900|250|450|0',
|
900: '900|250|450|0',
|
||||||
950: '950|250|450|0',
|
950: '950|250|450|0',
|
||||||
1000: '1000|500|600|6',
|
1000: '1000|500|600|6'
|
||||||
1001: '1001|300|450|6'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _is_pi_zero():
|
|
||||||
try:
|
|
||||||
subprocess.check_call('grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]09[0-9a-fA-F]$" /proc/cpuinfo', shell=True)
|
|
||||||
return True
|
|
||||||
|
|
||||||
except:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def _get_board_settings():
|
def _get_board_settings():
|
||||||
gpu_mem = 128
|
gpu_mem = 128
|
||||||
camera_led = True
|
camera_led = True
|
||||||
if _is_pi_zero():
|
arm_freq = None
|
||||||
arm_freq = 1001
|
|
||||||
|
|
||||||
else:
|
|
||||||
arm_freq = 700
|
|
||||||
|
|
||||||
if os.path.exists(CONFIG_TXT):
|
if os.path.exists(CONFIG_TXT):
|
||||||
logging.debug('reading board settings from %s' % CONFIG_TXT)
|
logging.debug('reading board settings from %s' % CONFIG_TXT)
|
||||||
@ -102,7 +87,7 @@ def _get_board_settings():
|
|||||||
elif name == 'disable_camera_led':
|
elif name == 'disable_camera_led':
|
||||||
camera_led = value == '0'
|
camera_led = value == '0'
|
||||||
|
|
||||||
overclock = OVERCLOCK.get(arm_freq, '700|250|400|0')
|
overclock = OVERCLOCK.get(arm_freq, 'none')
|
||||||
|
|
||||||
s = {
|
s = {
|
||||||
'gpuMem': gpu_mem,
|
'gpuMem': gpu_mem,
|
||||||
@ -117,7 +102,7 @@ def _get_board_settings():
|
|||||||
|
|
||||||
def _set_board_settings(s):
|
def _set_board_settings(s):
|
||||||
s.setdefault('gpuMem', 128)
|
s.setdefault('gpuMem', 128)
|
||||||
s.setdefault('overclock', '700|250|400|0')
|
s.setdefault('overclock', 'none')
|
||||||
s.setdefault('cameraLed', True)
|
s.setdefault('cameraLed', True)
|
||||||
|
|
||||||
old_settings = _get_board_settings()
|
old_settings = _get_board_settings()
|
||||||
@ -129,7 +114,13 @@ def _set_board_settings(s):
|
|||||||
logging.debug('writing board settings to %s: ' % CONFIG_TXT +
|
logging.debug('writing board settings to %s: ' % CONFIG_TXT +
|
||||||
'gpu_mem=%(gpuMem)s, overclock=%(overclock)s, camera_led=%(cameraLed)s' % s)
|
'gpu_mem=%(gpuMem)s, overclock=%(overclock)s, camera_led=%(cameraLed)s' % s)
|
||||||
|
|
||||||
|
if s['overclock'] != 'none':
|
||||||
arm_freq, gpu_freq, sdram_freq, over_voltage = s['overclock'].split('|')
|
arm_freq, gpu_freq, sdram_freq, over_voltage = s['overclock'].split('|')
|
||||||
|
overclocked = True
|
||||||
|
|
||||||
|
else:
|
||||||
|
arm_freq, gpu_freq, sdram_freq, over_voltage = OVERCLOCK[800].split('|')
|
||||||
|
overclocked = False
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
if os.path.exists(CONFIG_TXT):
|
if os.path.exists(CONFIG_TXT):
|
||||||
@ -155,21 +146,21 @@ def _set_board_settings(s):
|
|||||||
if name.startswith('gpu_mem'):
|
if name.startswith('gpu_mem'):
|
||||||
lines[i] = '%s=%s' % (name, s['gpuMem'])
|
lines[i] = '%s=%s' % (name, s['gpuMem'])
|
||||||
|
|
||||||
elif name == 'arm_freq':
|
|
||||||
lines[i] = 'arm_freq=%s' % arm_freq
|
|
||||||
|
|
||||||
elif name in ['gpu_freq', 'core_freq']:
|
|
||||||
lines[i] = '%s=%s' % (name, gpu_freq)
|
|
||||||
|
|
||||||
elif name == 'sdram_freq':
|
|
||||||
lines[i] = 'sdram_freq=%s' % sdram_freq
|
|
||||||
|
|
||||||
elif name == 'over_voltage':
|
|
||||||
lines[i] = 'over_voltage=%s' % over_voltage
|
|
||||||
|
|
||||||
elif name == 'disable_camera_led':
|
elif name == 'disable_camera_led':
|
||||||
lines[i] = 'disable_camera_led=%s' % ['1', '0'][s['cameraLed']]
|
lines[i] = 'disable_camera_led=%s' % ['1', '0'][s['cameraLed']]
|
||||||
|
|
||||||
|
if name == 'arm_freq':
|
||||||
|
lines[i] = ('' if overclocked else '#') + 'arm_freq=%s' % arm_freq
|
||||||
|
|
||||||
|
elif name in ['gpu_freq', 'core_freq']:
|
||||||
|
lines[i] = ('' if overclocked else '#') + '%s=%s' % (name, gpu_freq)
|
||||||
|
|
||||||
|
elif name == 'sdram_freq':
|
||||||
|
lines[i] = ('' if overclocked else '#') + 'sdram_freq=%s' % sdram_freq
|
||||||
|
|
||||||
|
elif name == 'over_voltage':
|
||||||
|
lines[i] = ('' if overclocked else '#') + 'over_voltage=%s' % over_voltage
|
||||||
|
|
||||||
if 'gpu_mem' not in seen:
|
if 'gpu_mem' not in seen:
|
||||||
lines.append('gpu_mem=%s' % s['gpuMem'])
|
lines.append('gpu_mem=%s' % s['gpuMem'])
|
||||||
|
|
||||||
@ -179,21 +170,21 @@ def _set_board_settings(s):
|
|||||||
if 'gpu_mem_512' not in seen:
|
if 'gpu_mem_512' not in seen:
|
||||||
lines.append('gpu_mem_512=%s' % s['gpuMem'])
|
lines.append('gpu_mem_512=%s' % s['gpuMem'])
|
||||||
|
|
||||||
if 'arm_freq' not in seen:
|
|
||||||
lines.append('arm_freq=%s' % arm_freq)
|
|
||||||
|
|
||||||
if 'gpu_freq' not in seen:
|
|
||||||
lines.append('gpu_freq=%s' % gpu_freq)
|
|
||||||
|
|
||||||
if 'sdram_freq' not in seen:
|
|
||||||
lines.append('sdram_freq=%s' % sdram_freq)
|
|
||||||
|
|
||||||
if 'over_voltage' not in seen:
|
|
||||||
lines.append('over_voltage=%s' % over_voltage)
|
|
||||||
|
|
||||||
if 'disable_camera_led' not in seen:
|
if 'disable_camera_led' not in seen:
|
||||||
lines.append('disable_camera_led=%s' % ['1', '0'][s['cameraLed']])
|
lines.append('disable_camera_led=%s' % ['1', '0'][s['cameraLed']])
|
||||||
|
|
||||||
|
if 'arm_freq' not in seen:
|
||||||
|
lines.append(('' if overclocked else '#') + 'arm_freq=%s' % arm_freq)
|
||||||
|
|
||||||
|
if 'gpu_freq' not in seen:
|
||||||
|
lines.append(('' if overclocked else '#') + 'gpu_freq=%s' % gpu_freq)
|
||||||
|
|
||||||
|
if 'sdram_freq' not in seen:
|
||||||
|
lines.append(('' if overclocked else '#') + 'sdram_freq=%s' % sdram_freq)
|
||||||
|
|
||||||
|
if 'over_voltage' not in seen:
|
||||||
|
lines.append(('' if overclocked else '#') + 'over_voltage=%s' % over_voltage)
|
||||||
|
|
||||||
logging.debug('remounting /boot read-write')
|
logging.debug('remounting /boot read-write')
|
||||||
if os.system('mount -o remount,rw /boot'):
|
if os.system('mount -o remount,rw /boot'):
|
||||||
logging.error('failed to remount /boot read-write')
|
logging.error('failed to remount /boot read-write')
|
||||||
@ -279,12 +270,11 @@ def overclock():
|
|||||||
'description': 'choose an overclocking preset for your Raspberry PI',
|
'description': 'choose an overclocking preset for your Raspberry PI',
|
||||||
'type': 'choices',
|
'type': 'choices',
|
||||||
'choices': [
|
'choices': [
|
||||||
('700|250|400|0', 'none (700/250/400/0)'),
|
('none', '(none)'),
|
||||||
('800|250|400|0', 'modest (800/250/400/0)'),
|
('800|250|400|0', 'modest (800/250/400/0)'),
|
||||||
('900|250|450|0', 'medium (900/250/450/0)'),
|
('900|250|450|0', 'medium (900/250/450/0)'),
|
||||||
('950|250|450|0', 'high (950/250/450/0)'),
|
('950|250|450|0', 'high (950/250/450/0)'),
|
||||||
('1000|500|600|6', 'turbo (1000/500/600/6)'),
|
('1000|500|600|6', 'turbo (1000/500/600/6)')
|
||||||
('1001|300|450|6', 'PiZero (1000/300/450/6)'),
|
|
||||||
],
|
],
|
||||||
'section': 'expertSettings',
|
'section': 'expertSettings',
|
||||||
'advanced': True,
|
'advanced': True,
|
||||||
|
@ -53,14 +53,13 @@ OVERCLOCK = {
|
|||||||
800: '800|250|400|0',
|
800: '800|250|400|0',
|
||||||
900: '900|250|450|0',
|
900: '900|250|450|0',
|
||||||
950: '950|250|450|0',
|
950: '950|250|450|0',
|
||||||
1000: '1000|500|600|6',
|
1000: '1000|500|600|6'
|
||||||
1001: '1001|500|500|2'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_board_settings():
|
def _get_board_settings():
|
||||||
gpu_mem = 128
|
gpu_mem = 128
|
||||||
camera_led = True
|
camera_led = True
|
||||||
arm_freq = 1001
|
arm_freq = None
|
||||||
|
|
||||||
if os.path.exists(CONFIG_TXT):
|
if os.path.exists(CONFIG_TXT):
|
||||||
logging.debug('reading board settings from %s' % CONFIG_TXT)
|
logging.debug('reading board settings from %s' % CONFIG_TXT)
|
||||||
@ -79,7 +78,7 @@ def _get_board_settings():
|
|||||||
name = name.strip()
|
name = name.strip()
|
||||||
value = value.strip()
|
value = value.strip()
|
||||||
|
|
||||||
if name == 'gpu_mem':
|
if name.startswith('gpu_mem'):
|
||||||
gpu_mem = int(value)
|
gpu_mem = int(value)
|
||||||
|
|
||||||
elif name == 'arm_freq':
|
elif name == 'arm_freq':
|
||||||
@ -88,7 +87,7 @@ def _get_board_settings():
|
|||||||
elif name == 'disable_camera_led':
|
elif name == 'disable_camera_led':
|
||||||
camera_led = value == '0'
|
camera_led = value == '0'
|
||||||
|
|
||||||
overclock = OVERCLOCK.get(arm_freq, '700|250|400|0')
|
overclock = OVERCLOCK.get(arm_freq, 'none')
|
||||||
|
|
||||||
s = {
|
s = {
|
||||||
'gpuMem': gpu_mem,
|
'gpuMem': gpu_mem,
|
||||||
@ -103,7 +102,7 @@ def _get_board_settings():
|
|||||||
|
|
||||||
def _set_board_settings(s):
|
def _set_board_settings(s):
|
||||||
s.setdefault('gpuMem', 128)
|
s.setdefault('gpuMem', 128)
|
||||||
s.setdefault('overclock', '700|250|400|0')
|
s.setdefault('overclock', 'none')
|
||||||
s.setdefault('cameraLed', True)
|
s.setdefault('cameraLed', True)
|
||||||
|
|
||||||
old_settings = _get_board_settings()
|
old_settings = _get_board_settings()
|
||||||
@ -115,7 +114,13 @@ def _set_board_settings(s):
|
|||||||
logging.debug('writing board settings to %s: ' % CONFIG_TXT +
|
logging.debug('writing board settings to %s: ' % CONFIG_TXT +
|
||||||
'gpu_mem=%(gpuMem)s, overclock=%(overclock)s, camera_led=%(cameraLed)s' % s)
|
'gpu_mem=%(gpuMem)s, overclock=%(overclock)s, camera_led=%(cameraLed)s' % s)
|
||||||
|
|
||||||
|
if s['overclock'] != 'none':
|
||||||
arm_freq, gpu_freq, sdram_freq, over_voltage = s['overclock'].split('|')
|
arm_freq, gpu_freq, sdram_freq, over_voltage = s['overclock'].split('|')
|
||||||
|
overclocked = True
|
||||||
|
|
||||||
|
else:
|
||||||
|
arm_freq, gpu_freq, sdram_freq, over_voltage = OVERCLOCK[800].split('|')
|
||||||
|
overclocked = False
|
||||||
|
|
||||||
lines = []
|
lines = []
|
||||||
if os.path.exists(CONFIG_TXT):
|
if os.path.exists(CONFIG_TXT):
|
||||||
@ -141,39 +146,39 @@ def _set_board_settings(s):
|
|||||||
if name == 'gpu_mem':
|
if name == 'gpu_mem':
|
||||||
lines[i] = '%s=%s' % (name, s['gpuMem'])
|
lines[i] = '%s=%s' % (name, s['gpuMem'])
|
||||||
|
|
||||||
elif name == 'arm_freq':
|
|
||||||
lines[i] = 'arm_freq=%s' % arm_freq
|
|
||||||
|
|
||||||
elif name in ['gpu_freq', 'core_freq']:
|
|
||||||
lines[i] = '%s=%s' % (name, gpu_freq)
|
|
||||||
|
|
||||||
elif name == 'sdram_freq':
|
|
||||||
lines[i] = 'sdram_freq=%s' % sdram_freq
|
|
||||||
|
|
||||||
elif name == 'over_voltage':
|
|
||||||
lines[i] = 'over_voltage=%s' % over_voltage
|
|
||||||
|
|
||||||
elif name == 'disable_camera_led':
|
elif name == 'disable_camera_led':
|
||||||
lines[i] = 'disable_camera_led=%s' % ['1', '0'][s['cameraLed']]
|
lines[i] = 'disable_camera_led=%s' % ['1', '0'][s['cameraLed']]
|
||||||
|
|
||||||
|
if name == 'arm_freq':
|
||||||
|
lines[i] = ('' if overclocked else '#') + 'arm_freq=%s' % arm_freq
|
||||||
|
|
||||||
|
elif name in ['gpu_freq', 'core_freq']:
|
||||||
|
lines[i] = ('' if overclocked else '#') + '%s=%s' % (name, gpu_freq)
|
||||||
|
|
||||||
|
elif name == 'sdram_freq':
|
||||||
|
lines[i] = ('' if overclocked else '#') + 'sdram_freq=%s' % sdram_freq
|
||||||
|
|
||||||
|
elif name == 'over_voltage':
|
||||||
|
lines[i] = ('' if overclocked else '#') + 'over_voltage=%s' % over_voltage
|
||||||
|
|
||||||
if 'gpu_mem' not in seen:
|
if 'gpu_mem' not in seen:
|
||||||
lines.append('gpu_mem=%s' % s['gpuMem'])
|
lines.append('gpu_mem=%s' % s['gpuMem'])
|
||||||
|
|
||||||
if 'arm_freq' not in seen:
|
|
||||||
lines.append('arm_freq=%s' % arm_freq)
|
|
||||||
|
|
||||||
if 'gpu_freq' not in seen:
|
|
||||||
lines.append('gpu_freq=%s' % gpu_freq)
|
|
||||||
|
|
||||||
if 'sdram_freq' not in seen:
|
|
||||||
lines.append('sdram_freq=%s' % sdram_freq)
|
|
||||||
|
|
||||||
if 'over_voltage' not in seen:
|
|
||||||
lines.append('over_voltage=%s' % over_voltage)
|
|
||||||
|
|
||||||
if 'disable_camera_led' not in seen:
|
if 'disable_camera_led' not in seen:
|
||||||
lines.append('disable_camera_led=%s' % ['1', '0'][s['cameraLed']])
|
lines.append('disable_camera_led=%s' % ['1', '0'][s['cameraLed']])
|
||||||
|
|
||||||
|
if 'arm_freq' not in seen:
|
||||||
|
lines.append(('' if overclocked else '#') + 'arm_freq=%s' % arm_freq)
|
||||||
|
|
||||||
|
if 'gpu_freq' not in seen:
|
||||||
|
lines.append(('' if overclocked else '#') + 'gpu_freq=%s' % gpu_freq)
|
||||||
|
|
||||||
|
if 'sdram_freq' not in seen:
|
||||||
|
lines.append(('' if overclocked else '#') + 'sdram_freq=%s' % sdram_freq)
|
||||||
|
|
||||||
|
if 'over_voltage' not in seen:
|
||||||
|
lines.append(('' if overclocked else '#') + 'over_voltage=%s' % over_voltage)
|
||||||
|
|
||||||
logging.debug('remounting /boot read-write')
|
logging.debug('remounting /boot read-write')
|
||||||
if os.system('mount -o remount,rw /boot'):
|
if os.system('mount -o remount,rw /boot'):
|
||||||
logging.error('failed to remount /boot read-write')
|
logging.error('failed to remount /boot read-write')
|
||||||
@ -259,12 +264,11 @@ def overclock():
|
|||||||
'description': 'choose an overclocking preset for your Raspberry PI',
|
'description': 'choose an overclocking preset for your Raspberry PI',
|
||||||
'type': 'choices',
|
'type': 'choices',
|
||||||
'choices': [
|
'choices': [
|
||||||
('700|250|400|0', 'none (700/250/400/0)'),
|
('none', '(none)'),
|
||||||
('800|250|400|0', 'modest (800/250/400/0)'),
|
('800|250|400|0', 'modest (800/250/400/0)'),
|
||||||
('900|250|450|0', 'medium (900/250/450/0)'),
|
('900|250|450|0', 'medium (900/250/450/0)'),
|
||||||
('950|250|450|0', 'high (950/250/450/0)'),
|
('950|250|450|0', 'high (950/250/450/0)'),
|
||||||
('1000|500|600|6', 'turbo (1000/500/600/6)'),
|
('1000|500|600|6', 'turbo (1000/500/600/6)')
|
||||||
('1001|500|500|2', 'Pi2 (1000/500/500/2)')
|
|
||||||
],
|
],
|
||||||
'section': 'expertSettings',
|
'section': 'expertSettings',
|
||||||
'advanced': True,
|
'advanced': True,
|
||||||
|
@ -53,14 +53,13 @@ OVERCLOCK = {
|
|||||||
800: '800|250|400|0',
|
800: '800|250|400|0',
|
||||||
900: '900|250|450|0',
|
900: '900|250|450|0',
|
||||||
950: '950|250|450|0',
|
950: '950|250|450|0',
|
||||||
1000: '1000|500|600|6',
|
1000: '1000|500|600|6'
|
||||||
1001: '1001|500|500|2'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_board_settings():
|
def _get_board_settings():
|
||||||
gpu_mem = 128
|
gpu_mem = 128
|
||||||
camera_led = True
|
camera_led = True
|
||||||
arm_freq = 700
|
arm_freq = None
|
||||||
|
|
||||||
if os.path.exists(CONFIG_TXT):
|
if os.path.exists(CONFIG_TXT):
|
||||||
logging.debug('reading board settings from %s' % CONFIG_TXT)
|
logging.debug('reading board settings from %s' % CONFIG_TXT)
|
||||||
@ -133,7 +132,7 @@ def _set_board_settings(s):
|
|||||||
|
|
||||||
seen.add(name)
|
seen.add(name)
|
||||||
|
|
||||||
if name == 'gpu_mem':
|
if name.startswith('gpu_mem'):
|
||||||
lines[i] = '%s=%s' % (name, s['gpuMem'])
|
lines[i] = '%s=%s' % (name, s['gpuMem'])
|
||||||
|
|
||||||
elif name == 'disable_camera_led':
|
elif name == 'disable_camera_led':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user