Changes made to logging process.
authorMartin Prudek <prudemar@fel.cvut.cz>
Sun, 17 May 2015 10:41:49 +0000 (12:41 +0200)
committerMartin Prudek <prudemar@fel.cvut.cz>
Sun, 17 May 2015 10:41:49 +0000 (12:41 +0200)
pmsm-control/test_sw/cmd_proc.c
pmsm-control/test_sw/main_pmsm.c
pmsm-control/test_sw/pmsm_state.h

index 953567e..9625c1d 100644 (file)
@@ -60,6 +60,9 @@ static void start(struct rpi_state* state){
 static void stop(struct rpi_state* state){
        sem_wait(&state->thd_par_sem);
        state->commutate=0;
+       state->pos_reg_ena=0;
+       state->spd_reg_ena=0;
+       state->duty=0;
        state->pwm1=0;
        state->pwm2=0;
        state->pwm3=0;
@@ -153,7 +156,7 @@ static void saveLogs(struct rpi_state* state){
        FILE *f;
        int r,s;
 
-       f = fopen("logs.txt", "w");
+       f = fopen("logs.log", "w");
        if (f == NULL){
                printf("Error opening file!\n");
                return;
index 65df8f1..4d58037 100644 (file)
@@ -27,7 +27,7 @@
 
 
 #define PID_P          0.3
-#define PID_P_S                0.9     /*2.3 kmita*/ /*1.4 vhodne jen pro P regulator*/
+#define PID_P_S                0.8     /*2.3 kmita*/ /*1.4 vhodne jen pro P regulator*/
 #define PID_I_S                0.01
 
 #define PRIOR_KERN     50
@@ -126,9 +126,18 @@ void makeLog(){
        }
        rps.logs[0][rps.log_col]=(int)rps.tf_count;
        rps.logs[1][rps.log_col]=(int)rps.spi_dat->pozice;
+
        rps.logs[2][rps.log_col]=(int)rps.pwm1;
        rps.logs[3][rps.log_col]=(int)rps.pwm2;
        rps.logs[4][rps.log_col]=(int)rps.pwm3;
+       rps.logs[5][rps.log_col]=rps.duty;
+
+       rps.logs[6][rps.log_col]=rps.desired_spd;
+       rps.logs[7][rps.log_col]=rps.speed;
+
+       rps.logs[8][rps.log_col]=(int)(rps.spi_dat->ch1/rps.spi_dat->adc_m_count);
+       rps.logs[9][rps.log_col]=(int)(rps.spi_dat->ch2/rps.spi_dat->adc_m_count);
+       rps.logs[10][rps.log_col]=(int)(rps.spi_dat->ch0/rps.spi_dat->adc_m_count);
 
        rps.log_col++;
      /*
index d645791..20e60e6 100644 (file)
@@ -8,10 +8,10 @@
 #define MAX_DUTY       170
 #define MAX_SPEED      (7*OLD_POS_NUM)
 
-#define LOG_ROWS       5
-#define LOG_DEF_COL    1000
-#define MAX_LOGS       1000
-#define LOG_PERIOD     5
+#define LOG_ROWS       11
+#define LOG_DEF_COL    8000
+#define MAX_LOGS       8000
+#define LOG_PERIOD     2
 
 struct rpi_in;