Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-init
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-init
Commits
22b0e701
Commit
22b0e701
authored
Oct 26, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init for eyesis
parent
4b86ec7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
36 deletions
+82
-36
init_elphel393.py
src/init_elphel393.py
+82
-36
No files found.
src/init_elphel393.py
View file @
22b0e701
...
@@ -59,6 +59,9 @@ def init_ipaddr(ip):
...
@@ -59,6 +59,9 @@ def init_ipaddr(ip):
def
init_mcntrl
(
pydir
,
verilogdir
):
def
init_mcntrl
(
pydir
,
verilogdir
):
shout
(
pydir
+
"/test_mcntrl.py @"
+
verilogdir
+
"/hargs"
)
shout
(
pydir
+
"/test_mcntrl.py @"
+
verilogdir
+
"/hargs"
)
def
init_mcntrl_eyesis
(
pydir
,
verilogdir
):
shout
(
pydir
+
"/test_mcntrl.py @"
+
verilogdir
+
"/hargs-eyesis"
)
def
init_imgsrv
(
port
):
def
init_imgsrv
(
port
):
shout
(
"imgsrv -p "
+
str
(
port
))
shout
(
"imgsrv -p "
+
str
(
port
))
#restart PHP - it can get errors while opening/mmaping at startup, then some functions fail
#restart PHP - it can get errors while opening/mmaping at startup, then some functions fail
...
@@ -66,8 +69,32 @@ def init_imgsrv(port):
...
@@ -66,8 +69,32 @@ def init_imgsrv(port):
shout
(
"/www/pages/exif.php init=/etc/Exif_template.xml"
)
shout
(
"/www/pages/exif.php init=/etc/Exif_template.xml"
)
def
init_port
(
index
):
def
init_port
(
index
):
print
(
"Port "
+
index
+
": framepars enable"
)
shout
(
"wget -O /dev/null
\"
localhost/framepars.php?sensor_port="
+
index
+
"&cmd=init
\"
"
)
sysfs_content
=
init_port_readsysfs
(
"port_mux"
+
index
)
if
sysfs_content
==
"mux10359"
:
init_mux10359
(
index
)
else
:
sysfs_content
=
init_port_readsysfs
(
"sensor"
+
index
+
"0"
)
#Sensor list
#1. mt9p006
#2. mt9f002
#3. ...
if
(
sysfs_content
==
"mt9p006"
):
print
(
"Port "
+
index
+
": framepars enable"
)
shout
(
"wget -O /dev/null
\"
localhost/framepars.php?sensor_port="
+
index
+
"&cmd=init
\"
"
)
else
:
switch
[
'port'
+
str
(
i
)]
=
0
print
(
"Sensor port "
+
str
(
i
)
+
": disabled, please check device tree"
)
def
init_port_readsysfs
(
filename
):
sysfs_content
=
""
with
open
(
"/sys/devices/soc0/elphel393-detect_sensors@0/"
+
filename
,
'r'
)
as
content_file
:
sysfs_content
=
content_file
.
read
()
sysfs_content
=
sysfs_content
.
strip
()
return
sysfs_content
def
init_mux10359
(
index
):
shout
(
"cat /usr/local/verilog/x359.bit > /dev/sfpgaconfjtag"
+
index
)
def
init_autoexp
(
index
):
def
init_autoexp
(
index
):
shout
(
"autoexposure -p "
+
index
+
" -c 0 -b 0 -d 1 &"
)
shout
(
"autoexposure -p "
+
index
+
" -c 0 -b 0 -d 1 &"
)
...
@@ -76,6 +103,9 @@ def init_autoexp(index):
...
@@ -76,6 +103,9 @@ def init_autoexp(index):
def
init_autowb
(
index
):
def
init_autowb
(
index
):
shout
(
"wget -O /dev/null
\"
localhost/parsedit.php?immediate&sensor_port="
+
index
+
"&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x20000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000
\"
"
)
shout
(
"wget -O /dev/null
\"
localhost/parsedit.php?immediate&sensor_port="
+
index
+
"&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x1&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x20000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x10000&GAING=0x10000&GAINGB=0x10000&GAINB=0x10000
\"
"
)
def
init_autowb_eyesis
(
index
):
shout
(
"wget -O /dev/null
\"
localhost/parsedit.php?immediate&sensor_port="
+
index
+
"&COMPRESSOR_RUN=2&DAEMON_EN=1&WB_EN=0x0&WB_MASK=0xd&WB_PERIOD=16&WB_WHITELEV=0xfae1&WB_WHITEFRAC=0x028f&WB_SCALE_R=0x10000&WB_SCALE_GB=0x10000&WB_SCALE_B=0x10000&WB_THRESH=500&GAIN_MIN=0x20000&GAIN_MAX=0xfc000&ANA_GAIN_ENABLE=1&GAINR=0x1be3e&GAING=0x18000&GAINGB=0x18000&GAINB=0x26667
\"
"
)
def
init_sata
(
sata_en
,
pydir
):
def
init_sata
(
sata_en
,
pydir
):
if
(
sata_en
==
1
):
if
(
sata_en
==
1
):
shout
(
pydir
+
"/x393sata.py"
)
shout
(
pydir
+
"/x393sata.py"
)
...
@@ -123,7 +153,8 @@ switch = {
...
@@ -123,7 +153,8 @@ switch = {
'autoexp'
:
1
,
'autoexp'
:
1
,
'autowb'
:
1
,
'autowb'
:
1
,
'sata'
:
1
,
'sata'
:
1
,
'gps'
:
1
'gps'
:
1
,
'eyesis'
:
0
}
}
# update from argv
# update from argv
...
@@ -149,56 +180,71 @@ else:
...
@@ -149,56 +180,71 @@ else:
#2
#2
if
switch
[
'mcntrl'
]
==
1
:
if
switch
[
'mcntrl'
]
==
1
:
print
(
sys
.
argv
[
0
]
+
": mcntrl"
)
print
(
sys
.
argv
[
0
]
+
": mcntrl"
)
init_mcntrl
(
PYDIR
,
VERILOG_DIR
)
if
switch
[
'eyesis'
]
!=
0
:
init_mcntrl_eyesis
(
PYDIR
,
VERILOG_DIR
)
else
:
init_mcntrl
(
PYDIR
,
VERILOG_DIR
)
else
:
else
:
print
(
"skip mcntrl"
)
print
(
"skip mcntrl"
)
#3
#3
if
switch
[
'imgsrv'
]
==
1
:
if
switch
[
'imgsrv'
]
==
1
:
print
(
sys
.
argv
[
0
]
+
": imgsrv"
)
print
(
sys
.
argv
[
0
]
+
": imgsrv"
)
init_imgsrv
(
IMGSRV_PORT
)
init_imgsrv
(
IMGSRV_PORT
)
else
:
else
:
print
(
"skip imgsrv"
)
print
(
"skip imgsrv"
)
#4
#4
print
(
sys
.
argv
[
0
]
+
": init ports"
)
print
(
sys
.
argv
[
0
]
+
": init ports"
)
for
i
in
range
(
1
,
5
):
for
i
in
range
(
1
,
5
):
if
switch
[
'port'
+
str
(
i
)]
==
1
:
if
switch
[
'port'
+
str
(
i
)]
==
1
:
index
=
str
(
i
-
1
)
init_port
(
str
(
i
-
1
))
sysfs_content
=
""
# read sysfs, overwrite if argv?!
with
open
(
"/sys/devices/soc0/elphel393-detect_sensors@0/sensor"
+
index
+
"0"
,
'r'
)
as
content_file
:
sysfs_content
=
content_file
.
read
()
sysfs_content
=
sysfs_content
.
strip
()
#Sensor list
#1. mt9p006
#2. mt9f002
#3. ...
if
(
sysfs_content
==
"mt9p006"
):
init_port
(
index
)
else
:
switch
[
'port'
+
str
(
i
)]
=
0
print
(
"Sensor port "
+
str
(
i
)
+
": disabled, please check device tree"
)
else
:
else
:
print
(
"skip sensor port "
+
str
(
i
))
print
(
"skip sensor port "
+
str
(
i
))
time
.
sleep
(
1
)
time
.
sleep
(
1
)
#5
#5
print
(
sys
.
argv
[
0
]
+
": auto exposure and auto white balance"
)
if
switch
[
'eyesis'
]
!=
0
:
for
i
in
range
(
1
,
5
):
for
i
in
range
(
4
):
if
switch
[
'port'
+
str
(
i
)]
==
1
:
sysfs_content
=
init_port_readsysfs
(
"sensor"
+
str
(
i
)
+
"0"
)
index
=
str
(
i
-
1
)
if
sysfs_content
==
"mt9p006"
:
if
switch
[
'autoexp'
]
==
1
:
shout
(
"wget -O -
\"
localhost/framepars.php?sensor_port="
+
str
(
i
)
+
"&cmd=min_init
\"
"
)
init_autoexp
(
index
)
time
.
sleep
(
2
)
else
:
print
(
"Port "
+
str
(
i
)
+
": skip autoexp"
)
for
i
in
range
(
4
):
sysfs_content
=
init_port_readsysfs
(
"sensor"
+
str
(
i
)
+
"0"
)
if
switch
[
'autowb'
]
==
1
:
if
sysfs_content
==
"mt9p006"
:
init_autowb
(
index
)
shout
(
"wget -O -
\"
localhost/framepars.php?sensor_port="
+
str
(
i
)
+
"&cmd=eyesis_trig
\"
"
)
else
:
time
.
sleep
(
2
)
print
(
"Port "
+
str
(
i
)
+
": skip autowb"
)
else
:
print
(
sys
.
argv
[
0
]
+
": auto exposure and auto white balance"
)
for
i
in
range
(
1
,
5
):
if
switch
[
'port'
+
str
(
i
)]
==
1
:
if
switch
[
'autoexp'
]
==
1
:
sysfs_content
=
init_port_readsysfs
(
"sensor"
+
str
(
i
)
+
"0"
)
if
sysfs_content
==
"mt9p006"
:
init_autoexp
(
str
(
i
-
1
))
else
:
print
(
"Port "
+
str
(
i
)
+
": skip autoexp"
)
if
switch
[
'autowb'
]
==
1
:
sysfs_content
=
init_port_readsysfs
(
"sensor"
+
str
(
i
)
+
"0"
)
if
sysfs_content
==
"mt9p006"
:
if
switch
[
'eyesis'
]
!=
0
:
init_autowb_eyesis
(
str
(
i
-
1
))
else
:
init_autowb
(
str
(
i
-
1
))
else
:
print
(
"Port "
+
str
(
i
)
+
": skip autowb"
)
#flips for eyesis head cams
if
switch
[
'eyesis'
]
==
1
:
shout
(
"wget -O /dev/null
\"
localhost/parsedit.php?immediate&sensor_port=3&MULTI_FLIPV=4
\"
"
)
shout
(
"wget -O /dev/null
\"
localhost/parsedit.php?immediate&sensor_port=2&MULTI_FLIPV=3
\"
"
)
shout
(
"wget -O /dev/null
\"
localhost/parsedit.php?immediate&sensor_port=0&MULTI_FLIPV=4
\"
"
)
shout
(
"wget -O /dev/null
\"
localhost/parsedit.php?immediate&sensor_port=1&MULTI_FLIPV=3
\"
"
)
#6
#6
print
(
sys
.
argv
[
0
]
+
" SATA"
)
print
(
sys
.
argv
[
0
]
+
" SATA"
)
...
@@ -208,7 +254,7 @@ else:
...
@@ -208,7 +254,7 @@ else:
print
(
"skip SATA"
)
print
(
"skip SATA"
)
#
6
#
7
print
(
sys
.
argv
[
0
]
+
" GPS"
)
print
(
sys
.
argv
[
0
]
+
" GPS"
)
if
switch
[
'gps'
]
==
1
:
if
switch
[
'gps'
]
==
1
:
start_gps_compass
()
start_gps_compass
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment