]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blobdiff - pmsm-control/test_sw/cmd_proc.c
Function Init_logs moved to right place.
[fpga/rpi-motor-control.git] / pmsm-control / test_sw / cmd_proc.c
index 8f49e91595b677a47377f8183a1844ab0adc2c7d..6846df594e5a57eb4ed02931d4565dcb72e8b2cb 100644 (file)
@@ -9,7 +9,7 @@
 #define PRUM_SOUC      6183
 
 static char doPrint = 1;
-static char error = 0;
+
 
 /*
  * \brief
@@ -61,7 +61,7 @@ static void start(struct rpi_state* state){
  */
 static void stop(struct rpi_state* state){
        sem_wait(&state->thd_par_sem);
-       state->commutate=0;
+       setCommutationOff(state);
        state->pos_reg_ena=0;
        state->spd_reg_ena=0;
        state->duty=0;
@@ -82,7 +82,7 @@ static void dutySet(struct rpi_state* state, int duty){
        state->duty=duty;
        state->pos_reg_ena=0;
        state->spd_reg_ena=0;
-       state->commutate=1;
+       setCommutationOn(state);
        sem_post(&state->thd_par_sem);
 }
 
@@ -94,7 +94,7 @@ static void goAbsolute(struct rpi_state* state, int pos){
        sem_wait(&state->thd_par_sem);
        state->spd_reg_ena=0;
        state->pos_reg_ena=1;
-       state->commutate=1;
+       setCommutationOn(state);
        state->desired_pos=pos;
        sem_post(&state->thd_par_sem);
 }
@@ -126,7 +126,7 @@ static void setSpeed(struct rpi_state* state, int speed){
        sem_wait(&state->thd_par_sem);
        state->pos_reg_ena=0;
        state->spd_reg_ena=1;
-       state->commutate=1;
+       setCommutationOn(state);
        state->desired_spd=speed;
        sem_post(&state->thd_par_sem);
 }
@@ -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;r<LOG_ROWS;r++){
-               state->logs[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");
 
 }