Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: log.cpp
- Revision:
- 12:58ad06f9847d
- Parent:
- 11:2156cb77d0d6
diff -r 2156cb77d0d6 -r 58ad06f9847d log.cpp --- a/log.cpp Fri Oct 04 09:58:51 2019 +0000 +++ b/log.cpp Fri Oct 04 22:20:23 2019 +0000 @@ -2,9 +2,11 @@ Timer t_loggingTimer; int i_logging_duration; +int i_last_log; bool b_LOG_READY = false; -Serial rs_LOG_pc(USBTX, USBRX,9600); -//Serial rs_LOG_odroid(PC_10, PC_11,115200); +Serial rs_LOG(PC_10, PC_11,115200); +//odroid(PC_10, PC_11); +//pc(USBTX, USBRX); s_Sample s_LOG_history[LOG_SIZE]; @@ -28,7 +30,9 @@ t_loggingTimer.stop(); t_loggingTimer.reset(); } - if(b_LOG_flag && i_LOG_index_data < LOG_SIZE) { + if(b_LOG_flag && i_LOG_index_data < LOG_SIZE && (t_loggingTimer.read_ms()-i_last_log) >= LOG_PERIOD_MS) { + i_last_log = t_loggingTimer.read_ms(); + s_LOG_history[i_LOG_index_data].timestamp = i_last_log; i_LOG_index_data ++; //rs_LOG_pc.printf("i_LOG_index_data:%d\r\n",i_LOG_index_data); } @@ -44,9 +48,9 @@ void log_pc() { - rs_LOG_pc.printf("timestamp;left_90;right_90;left_45;right_45;pwm_dir;odom;speed;\r\n"); + rs_LOG.printf("timestamp;left_90;right_90;left_45;right_45;pwm_dir_prec;odom;speed;angle_bord0;angle_bord1;angle_bord2;angle_bord3;angle_bord4;angle_bord5;angle_pos;angle;distParcourue;\r\n"); for(int i = 0; i<i_LOG_index_data; i++) { - rs_LOG_pc.printf("%d;%f;%f;%f;%f;%d;%f;%f;\r\n",s_LOG_history[i].timestamp,s_LOG_history[i].left_90,s_LOG_history[i].right_90,s_LOG_history[i].left_45,s_LOG_history[i].right_45,s_LOG_history[i].pwm_dir,s_LOG_history[i].odom,s_LOG_history[i].speed); + rs_LOG.printf("%d;%f;%f;%f;%f;%d;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f\r\n",s_LOG_history[i].timestamp,s_LOG_history[i].left_90,s_LOG_history[i].right_90,s_LOG_history[i].left_45,s_LOG_history[i].right_45,s_LOG_history[i].pwm_dir,s_LOG_history[i].odom,s_LOG_history[i].speed,s_LOG_history[i].angle_bord0,s_LOG_history[i].angle_bord1,s_LOG_history[i].angle_bord2,s_LOG_history[i].angle_bord3,s_LOG_history[i].angle_bord4,s_LOG_history[i].angle_bord5,s_LOG_history[i].angle_pos,s_LOG_history[i].angle,s_LOG_history[i].distParcourue); s_LOG_history[i].left_90 = 0.0; s_LOG_history[i].right_90 = 0.0; @@ -56,6 +60,15 @@ s_LOG_history[i].speed = 0.0; s_LOG_history[i].timestamp = 0; s_LOG_history[i].pwm_dir = 0; + s_LOG_history[i].angle_bord0 = 0.0; + s_LOG_history[i].angle_bord1 = 0.0; + s_LOG_history[i].angle_bord2 = 0.0; + s_LOG_history[i].angle_bord3 = 0.0; + s_LOG_history[i].angle_bord4 = 0.0; + s_LOG_history[i].angle_bord5 = 0.0; + s_LOG_history[i].angle_pos = 0; + s_LOG_history[i].angle = 0; + s_LOG_history[i].distParcourue = 0; }