Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-autocampars
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-apps-autocampars
Commits
2877732d
Commit
2877732d
authored
Nov 17, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing default page store, troubleshooting --init
parent
bfb3b46a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
8 deletions
+32
-8
autocampars.php
src/autocampars.php
+32
-8
No files found.
src/autocampars.php
View file @
2877732d
...
@@ -976,11 +976,12 @@ function processPost($port) {
...
@@ -976,11 +976,12 @@ function processPost($port) {
exit
(
0
);
exit
(
0
);
}
}
if
(
array_key_exists
(
'update_default'
,
$_POST
))
{
if
(
array_key_exists
(
'update_default'
,
$_POST
))
{
$GLOBALS
[
'configs'
]
[
'defaultPage'
]
=
$_POST
[
'default_page'
];
$GLOBALS
[
'configs'
]
[
$port
]
[
'defaultPage'
]
=
$_POST
[
'default_page'
];
log_msg
(
"processPost(
$port
) - updating default
"
);
log_msg
(
"processPost(
$port
) - updating default
,
\$
GLOBALS['configs'][
\$
port]['defaultPage'] = "
.
$GLOBALS
[
'configs'
]
[
$port
]
[
'defaultPage'
]
);
// log_msg("GLOBALS['configs']=".print_r($GLOBALS['configs'],1));
// log_msg("GLOBALS['configs']=".print_r($GLOBALS['configs'],1));
saveRotateConfig
(
$port
,
$GLOBALS
[
'numBackups'
]
);
saveRotateConfig
(
$port
,
$GLOBALS
[
'numBackups'
]
);
processGet
(
$port
);
processGet
(
$port
);
log_close
();
exit
(
0
);
exit
(
0
);
}
}
$needle
=
"save_"
;
$needle
=
"save_"
;
...
@@ -988,7 +989,7 @@ function processPost($port) {
...
@@ -988,7 +989,7 @@ function processPost($port) {
if
(
substr
(
$key
,
0
,
strlen
(
$needle
)
)
==
$needle
)
{
if
(
substr
(
$key
,
0
,
strlen
(
$needle
)
)
==
$needle
)
{
$page
=
substr
(
$key
,
strlen
(
$needle
)
);
$page
=
substr
(
$key
,
strlen
(
$needle
)
);
$page
=
readParsToPage
(
$port
,
$page
);
$page
=
readParsToPage
(
$port
,
$page
);
$GLOBALS
[
'configs'
]
[
'defaultPage'
]
=
$page
;
$GLOBALS
[
'configs'
]
[
$port
]
[
'defaultPage'
]
=
$page
;
log_msg
(
"processPost(
$port
) - save_"
);
log_msg
(
"processPost(
$port
) - save_"
);
// log_msg("GLOBALS['configs']=".print_r($GLOBALS['configs'],1));
// log_msg("GLOBALS['configs']=".print_r($GLOBALS['configs'],1));
saveRotateConfig
(
$port
,
$GLOBALS
[
'numBackups'
]
);
saveRotateConfig
(
$port
,
$GLOBALS
[
'numBackups'
]
);
...
@@ -1292,6 +1293,9 @@ function setParsFromPage($sensor_port, $page, $mask, $initmode = false) {
...
@@ -1292,6 +1293,9 @@ function setParsFromPage($sensor_port, $page, $mask, $initmode = false) {
// Similar things for nc353
// Similar things for nc353
$compressor_run
=
array
(
$compressor_run
=
array
(
'COMPRESSOR_RUN'
=>
2
'COMPRESSOR_RUN'
=>
2
);
$sensor_run
=
array
(
'SENSOR_RUN'
=>
2
);
);
$daemon_en
=
array
(
$daemon_en
=
array
(
'DAEMON_EN_AUTOEXPOSURE'
=>
1
,
'DAEMON_EN_AUTOEXPOSURE'
=>
1
,
...
@@ -1301,6 +1305,10 @@ function setParsFromPage($sensor_port, $page, $mask, $initmode = false) {
...
@@ -1301,6 +1305,10 @@ function setParsFromPage($sensor_port, $page, $mask, $initmode = false) {
'DAEMON_EN_TEMPERATURE'
=>
0
'DAEMON_EN_TEMPERATURE'
=>
0
);
);
if
(
isset
(
$parToSet
[
'SENSOR_RUN'
]
))
{
$sensor_run
[
'SENSOR_RUN'
]
=
$parToSet
[
'SENSOR_RUN'
];
unset
(
$parToSet
[
'SENSOR_RUN'
]
);
}
if
(
isset
(
$parToSet
[
'COMPRESSOR_RUN'
]
))
{
if
(
isset
(
$parToSet
[
'COMPRESSOR_RUN'
]
))
{
$compressor_run
[
'COMPRESSOR_RUN'
]
=
$parToSet
[
'COMPRESSOR_RUN'
];
$compressor_run
[
'COMPRESSOR_RUN'
]
=
$parToSet
[
'COMPRESSOR_RUN'
];
unset
(
$parToSet
[
'COMPRESSOR_RUN'
]
);
unset
(
$parToSet
[
'COMPRESSOR_RUN'
]
);
...
@@ -1341,18 +1349,32 @@ function setParsFromPage($sensor_port, $page, $mask, $initmode = false) {
...
@@ -1341,18 +1349,32 @@ function setParsFromPage($sensor_port, $page, $mask, $initmode = false) {
if
(
isset
(
$daemon_en
[
'DAEMON_EN_TEMPERATURE'
]
))
if
(
isset
(
$daemon_en
[
'DAEMON_EN_TEMPERATURE'
]
))
$daemon_en
[
'DAEMON_EN'
]
|=
$daemon_en
[
'DAEMON_EN_TEMPERATURE'
]
?
32
:
0
;
$daemon_en
[
'DAEMON_EN'
]
|=
$daemon_en
[
'DAEMON_EN_TEMPERATURE'
]
?
32
:
0
;
}
}
$frame_to_set
=
elphel_get_frame
(
$GLOBALS
[
'master_port'
]
)
+
ELPHEL_CONST_FRAME_DEAFAULT_AHEAD
;
$frame_to_set
=
elphel_get_frame
(
$GLOBALS
[
'master_port'
]
)
+
0
;
//
ELPHEL_CONST_FRAME_DEAFAULT_AHEAD;
// If it was called from already running
// If it was called from already running
if
(
elphel_get_P_value
(
$port
,
ELPHEL_COMPRESSOR_RUN
)
||
elphel_get_P_value
(
$port
,
ELPHEL_DAEMON_EN
))
{
if
(
elphel_get_P_value
(
$port
,
ELPHEL_COMPRESSOR_RUN
)
||
elphel_get_P_value
(
$port
,
ELPHEL_DAEMON_EN
))
{
$frame_to_set
+=
ELPHEL_CONST_FRAME_DEAFAULT_AHEAD
;
// Should we stop sequencers?
// Should we stop sequencers?
elphel_set_P_arr
(
$port
,
array
(
elphel_set_P_arr
(
$port
,
array
(
'COMPRESSOR_RUN'
=>
0
,
'COMPRESSOR_RUN'
=>
0
,
'SENSOR_RUN'
=>
0
,
'DAEMON_EN'
=>
0
'DAEMON_EN'
=>
0
),
$frame_to_set
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
// was -1 ("this frame")
),
$frame_to_set
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
// was -1 ("this frame")
$frame_to_set
+=
2
;
// advance frames, so next settings will be ASAP (sent immediate, not limited to 64?)
for
(
$i
=
0
;
$i
<
ELPHEL_CONST_FRAME_DEAFAULT_AHEAD
;
$i
++
){
// Single trigger
elphel_set_P_value
(
$GLOBALS
[
'master_port'
],
ELPHEL_TRIG_PERIOD
,
1
,
ELPHEL_CONST_FRAME_IMMED
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
usleep
(
$GLOBALS
[
'camera_state_arr'
][
'max_frame_time'
]);
// > 1 frame, so all channels will get trigger parameters? 3 2 2 1 -> 4 3 3 2
}
}
}
log_msg
(
"port "
.
$port
.
"
\$
frame_to_set="
.
$frame_to_set
.
", now= "
.
elphel_get_frame
(
$GLOBALS
[
'master_port'
]));
log_msg
(
"port "
.
$port
.
" setting @"
.
$frame_to_set
.
": "
.
print_r
(
$parToSet
,
1
));
log_msg
(
"port "
.
$port
.
" setting @"
.
$frame_to_set
.
": "
.
print_r
(
$parToSet
,
1
));
// set all in ASAP mode
elphel_set_P_arr
(
$port
,
$parToSet
,
$frame_to_set
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_arr
(
$port
,
$parToSet
,
$frame_to_set
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
$frame_to_set
+=
2
;
log_msg
(
"port "
.
$port
.
" setting @"
.
$frame_to_set
.
" SENSOR_RUN= "
.
$sensor_run
[
'SENSOR_RUN'
]);
elphel_set_P_arr
(
$port
,
$sensor_run
,
$frame_to_set
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
$frame_to_set
+=
2
;
$frame_to_set
+=
2
;
log_msg
(
"port "
.
$port
.
" setting @"
.
$frame_to_set
.
" COMPRESSOR_RUN= "
.
$compressor_run
[
'COMPRESSOR_RUN'
]);
log_msg
(
"port "
.
$port
.
" setting @"
.
$frame_to_set
.
" COMPRESSOR_RUN= "
.
$compressor_run
[
'COMPRESSOR_RUN'
]);
elphel_set_P_arr
(
$port
,
$compressor_run
,
$frame_to_set
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_arr
(
$port
,
$compressor_run
,
$frame_to_set
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
...
@@ -1437,7 +1459,7 @@ function readParsToPage($sensor_port, $page) {
...
@@ -1437,7 +1459,7 @@ function readParsToPage($sensor_port, $page) {
}
}
// elphel_parse_P_name
// elphel_parse_P_name
function
saveRotateConfig
(
$sensor_port
,
$numBackups
)
{
function
saveRotateConfig
(
$sensor_port
,
$numBackups
)
{
log_msg
(
"saveRotateConfig(
$sensor_port
,
$numBackups
)
"
);
log_msg
(
"saveRotateConfig(
$sensor_port
,
$numBackups
)
,
\$
GLOBALS['configs'] [
$sensor_port
] ['defaultPage'] = "
.
$GLOBALS
[
'configs'
]
[
$sensor_port
]
[
'defaultPage'
]
);
// log_msg("GLOBALS['configs']=".print_r($GLOBALS['configs'],1));
// log_msg("GLOBALS['configs']=".print_r($GLOBALS['configs'],1));
rotateConfig
(
$sensor_port
,
$numBackups
);
rotateConfig
(
$sensor_port
,
$numBackups
);
...
@@ -1521,6 +1543,8 @@ function parseConfig($filename) {
...
@@ -1521,6 +1543,8 @@ function parseConfig($filename) {
function
encodeConfig
(
$config
)
{
function
encodeConfig
(
$config
)
{
log_msg
(
"encodeConfig(): sensor_port="
.
$GLOBALS
[
'sensor_port'
]);
// , config=".print_r($config,1));
log_msg
(
"encodeConfig(): sensor_port="
.
$GLOBALS
[
'sensor_port'
]);
// , config=".print_r($config,1));
log_msg
(
"
\$
config['defaultPage'] = "
.
$config
[
'defaultPage'
]);
$xml
=
"<?xml version=
\"
1.0
\"
standalone=
\"
yes
\"
?>
\n
<!-- This file is generated by "
.
$_SERVER
[
'argv'
]
[
0
]
.
" -->
\n
"
;
$xml
=
"<?xml version=
\"
1.0
\"
standalone=
\"
yes
\"
?>
\n
<!-- This file is generated by "
.
$_SERVER
[
'argv'
]
[
0
]
.
" -->
\n
"
;
$xml
.=
" <autocampars>
\n
"
;
$xml
.=
" <autocampars>
\n
"
;
$xml
.=
"<!-- File version -->
\n
"
;
$xml
.=
"<!-- File version -->
\n
"
;
...
...
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