Commit df1c1959 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Do not reset disabled channels after start

This commit fixes a bug introduced in 076161cd where a list of active
sensor ports is updated every time recording has started.
parent bb4878ad
......@@ -223,6 +223,8 @@ void check_compressors(camogm_state *state)
if (getGPValue(i, P_COMPRESSOR_RUN) != COMPRESSOR_RUN_STOP) {
state->active_chn |= 1 << i;
}
// restore the state of disabled channels
state->active_chn &= state->active_chn_mask;
}
}
......@@ -274,6 +276,7 @@ void camogm_init(camogm_state *state, char *pipe_name, uint16_t port_num)
state->rawdev.curr_pos_w = state->rawdev.start_pos;
state->rawdev.curr_pos_r = state->rawdev.start_pos;
state->active_chn = ALL_CHN_INACTIVE;
state->active_chn_mask = ALL_CHN_ACTIVE;
state->rawdev.mmap_default_size = MMAP_CHUNK_SIZE;
state->sock_port = port_num;
......@@ -2077,10 +2080,13 @@ inline int is_chn_active(camogm_state *s, unsigned int port)
inline void set_chn_state(camogm_state *s, unsigned int port, unsigned int new_state)
{
if (port >= 0 && port < SENSOR_PORTS) {
if (new_state)
if (new_state) {
s->active_chn |= 1 << port;
else
s->active_chn_mask |= 1 << port;
} else {
s->active_chn &= ~(1 << port);
s->active_chn_mask &= ~(1 << port);
}
}
}
......
......@@ -256,6 +256,8 @@ typedef struct {
int rawdev_op; ///< flag indicating writing to raw device
rawdev_buffer rawdev; ///< contains pointers to raw device buffer
unsigned int active_chn; ///< bitmask of active sensor ports
unsigned int active_chn_mask; ///< bitmask of enabled sensor ports; used to save enabled/disabled ports between
///< consecutive starts/stops as active ports list is updated on each start
uint16_t sock_port; ///< command socket port number
struct writer_params writer_params; ///< contains control parameters for writing thread
unsigned int error_stat[SENSOR_PORTS][CAMOGM_ERRNUM]; ///< collect statistics about errors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment