#define PRUM_SOUC 6183
static char doPrint = 1;
+static char error = 0;
/*
* \brief
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;
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;
}
/*
FILE *f;
int r,s;
- f = fopen("logs.txt", "w");
+ f = fopen("logs.log", "w");
if (f == NULL){
printf("Error opening file!\n");
return;
/* spustim zachytavani logu */
}else{
logInit(state);
- state->doLogs=1;
sem_post(&state->thd_par_sem);
}
}
printf("duty=%d\n",s.duty);
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");
+
}