From: Martin Prudek Date: Wed, 20 May 2015 19:23:56 +0000 (+0200) Subject: Function Init_logs moved to right place. X-Git-Url: https://rtime.felk.cvut.cz/gitweb/fpga/rpi-motor-control.git/commitdiff_plain/f11e0e40b525a7dfd9d452e02e676ee6cd0478a2 Function Init_logs moved to right place. --- diff --git a/pmsm-control/test_sw/cmd_proc.c b/pmsm-control/test_sw/cmd_proc.c index bb3be07..6846df5 100644 --- a/pmsm-control/test_sw/cmd_proc.c +++ b/pmsm-control/test_sw/cmd_proc.c @@ -9,7 +9,7 @@ #define PRUM_SOUC 6183 static char doPrint = 1; -static char error = 0; + /* * \brief @@ -143,27 +143,6 @@ static void setAlphaOff(struct rpi_state* state, int offset){ sem_post(&state->thd_par_sem); } -/* - * \brief - * Initialize logs - */ -static void logInit(struct rpi_state* state){ - int r; - state->log_col=0; - state->log_col_count=LOG_DEF_COL; - for (r=0;rlogs[r]=malloc(state->log_col_count*sizeof(int)); - if (state->logs[r]==NULL){ - error=1; - state->log_col_count=-1; - return; - } - } - state->doLogs=1; -} - - - /** * \brief * SetLog @@ -291,6 +270,6 @@ void printData(struct rpi_state* state){ if (s.index_ok) printf("index ok\n"); if (s.commutate) printf("commutation in progress\n"); if (s.doLogs) printf("logujeme\n"); - if (error) printf("error pri maloc logs!! \n"); + if (s.error) printf("error pri maloc logs!! \n"); } diff --git a/pmsm-control/test_sw/logs.c b/pmsm-control/test_sw/logs.c index f6c2a5f..3a3e9cc 100644 --- a/pmsm-control/test_sw/logs.c +++ b/pmsm-control/test_sw/logs.c @@ -21,6 +21,25 @@ void freeLogs(struct rpi_state* this){ this->doLogs=0; } +/* + * \brief + * Initialize logs + */ +void logInit(struct rpi_state* state){ + int r; + state->log_col=0; + state->log_col_count=LOG_DEF_COL; + for (r=0;rlogs[r]=malloc(state->log_col_count*sizeof(int)); + if (state->logs[r]==NULL){ + state->error=1; + state->log_col_count=-1; + return; + } + } + state->doLogs=1; +} + /* * \brief * Makes log. diff --git a/pmsm-control/test_sw/logs.h b/pmsm-control/test_sw/logs.h index c0d1996..d3f2455 100644 --- a/pmsm-control/test_sw/logs.h +++ b/pmsm-control/test_sw/logs.h @@ -14,6 +14,12 @@ struct rpi_state; */ void makeLog(struct rpi_state*); +/* + * \brief + * Initialize logs + */ +void logInit(struct rpi_state*); + /* * \brief * Free logs memory. diff --git a/pmsm-control/test_sw/pmsm_state.h b/pmsm-control/test_sw/pmsm_state.h index b1946a6..583eb73 100644 --- a/pmsm-control/test_sw/pmsm_state.h +++ b/pmsm-control/test_sw/pmsm_state.h @@ -49,6 +49,8 @@ struct rpi_state{ void (*main_commutator)(struct rpi_state*); /* primarni komutator */ void (*main_controller)(struct rpi_state*); /* primarni regulator */ + + char error; /* detekce chyboveho stavu */ }; /**