+
+/*
+ * \brief
+ * Free logs
+ */
+void freeLogs(){
+ int r;
+ if (rps.log_col_count){
+ for (r=0;r<LOG_ROWS;r++){
+ free(rps.logs[r]);
+ }
+ }
+ rps.log_col_count=0;
+ rps.doLogs=0;
+}
+
+/*
+ * \brief
+ * Makes log.
+ */
+void makeLog(){
+ int r;
+ if (rps.log_col==MAX_LOGS-1){
+ rps.doLogs=0;
+ return;
+ }
+ 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++;
+ /*
+ if (rps.log_col==rps.log_col_count-1){
+ rps.log_col_count*=2;
+ rps.log_col_count%=MAX_LOGS;
+ for (r=0;r<LOG_ROWS;r++){
+ rps.logs[r]=realloc(rps.logs[r],rps.log_col_count*sizeof(int));
+ if (rps.logs[r]==NULL){
+ rps.doLogs=0;
+ rps.error=1;
+ }
+ }
+ }
+ */
+}
+