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
f6909a4c
Commit
f6909a4c
authored
Nov 25, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
highliting important messages
parent
009572bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
11 deletions
+23
-11
init_elphel393.py
src/init_elphel393.py
+23
-11
No files found.
src/init_elphel393.py
View file @
f6909a4c
...
@@ -96,12 +96,25 @@ def colorize(string, color, bold):
...
@@ -96,12 +96,25 @@ def colorize(string, color, bold):
attr
.
append
(
'1'
)
attr
.
append
(
'1'
)
return
'
\x1b
[
%
sm
%
s
\x1b
[0m'
%
(
';'
.
join
(
attr
),
string
)
return
'
\x1b
[
%
sm
%
s
\x1b
[0m'
%
(
';'
.
join
(
attr
),
string
)
def
log_msg
(
msg
):
def
log_msg
(
msg
,
mode
=
0
):
bold
=
False
color
=
""
if
mode
==
2
:
#bold red - error
color
=
"RED"
bold
=
True
elif
mode
==
3
:
# just bold
bold
=
True
elif
mode
==
4
:
# just bold
bold
=
True
color
=
"YELLOW"
#warning
with
open
(
'/proc/uptime'
)
as
f
:
with
open
(
'/proc/uptime'
)
as
f
:
t
=
float
(
f
.
read
()
.
split
()[
0
])
t
=
float
(
f
.
read
()
.
split
()[
0
])
with
open
(
LOGFILE
,
'a'
)
as
msg_file
:
with
open
(
LOGFILE
,
'a'
)
as
msg_file
:
print
(
colorize
(
"[
%8.2
f]
%
s: "
%
(
t
,
sys
.
argv
[
0
]
.
split
(
'/'
)[
-
1
]
.
split
(
'.'
)[
0
]),
'CYAN'
,
0
)
+
msg
)
print
(
"[
%8.2
f]
%
s"
%
(
t
,
msg
),
file
=
msg_file
)
print
(
"[
%8.2
f]
%
s"
%
(
t
,
msg
),
file
=
msg_file
)
if
bold
or
color
:
msg
=
colorize
(
msg
,
color
,
bold
)
print
(
colorize
(
"[
%8.2
f]
%
s: "
%
(
t
,
sys
.
argv
[
0
]
.
split
(
'/'
)[
-
1
]
.
split
(
'.'
)[
0
]),
'CYAN'
,
0
)
+
msg
)
def
shout
(
cmd
):
def
shout
(
cmd
):
#subprocess.call prints to console
#subprocess.call prints to console
...
@@ -173,14 +186,14 @@ def init_other_eyesis(index):
...
@@ -173,14 +186,14 @@ def init_other_eyesis(index):
def
init_sata
(
sata_en
,
pydir
):
def
init_sata
(
sata_en
,
pydir
):
if
(
sata_en
==
1
):
if
(
sata_en
==
1
):
if
not
get_fpga
():
if
not
get_fpga
():
log_msg
(
"Waiting for the FPGA to be programmed to start SATA"
)
log_msg
(
"Waiting for the FPGA to be programmed to start SATA"
,
4
)
if
not
fpga_OK
(
TIMEOUT
):
if
not
fpga_OK
(
TIMEOUT
):
print
()
print
()
log_msg
(
"Timeout while waiting for the FPGA to be programmed"
)
log_msg
(
"Timeout while waiting for the FPGA to be programmed"
,
2
)
return
return
else
:
else
:
print
(
" Done"
)
log_msg
(
"Done waiting for the FPGA"
,
4
)
shout
(
pydir
+
"/x393sata.py"
)
shout
(
pydir
+
"/x393sata.py"
)
# Should be after modprobe? Wait for the FPGA should be before it
shout
(
"modprobe ahci_elphel &"
)
shout
(
"modprobe ahci_elphel &"
)
shout
(
"sleep 2"
)
shout
(
"sleep 2"
)
shout
(
"echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module"
)
shout
(
"echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module"
)
...
@@ -207,14 +220,13 @@ def start_gps_compass():
...
@@ -207,14 +220,13 @@ def start_gps_compass():
Detect GPS and/or compass boards and start them
Detect GPS and/or compass boards and start them
"""
"""
if
not
get_fpga
():
if
not
get_fpga
():
log_msg
(
"Waiting for the FPGA to be programmed to start SATA"
)
log_msg
(
"Waiting for the FPGA to be programmed to start SATA"
,
4
)
if
not
fpga_OK
(
TIMEOUT
):
if
not
fpga_OK
(
TIMEOUT
):
print
()
print
()
log_msg
(
"Timeout while waiting for the FPGA to be programmed"
)
log_msg
(
"Timeout while waiting for the FPGA to be programmed"
,
2
)
return
return
else
:
else
:
print
(
" Done"
)
log_msg
(
"Done waiting for the FPGA"
,
4
)
shout
(
"start_gps_compass.php"
)
shout
(
"start_gps_compass.php"
)
def
disable_gpio_10389
():
def
disable_gpio_10389
():
...
@@ -392,4 +404,4 @@ else:
...
@@ -392,4 +404,4 @@ else:
log_msg
(
"/var/volatile/state already exists"
)
log_msg
(
"/var/volatile/state already exists"
)
log_msg
(
"DONE, log file: "
+
LOGFILE
)
log_msg
(
"DONE, log file: "
+
LOGFILE
,
3
)
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