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: main.cpp
- Revision:
- 68:bb2ee5b4f9dd
- Parent:
- 67:990fbcfee16f
- Child:
- 69:d7125d5b5cc8
--- a/main.cpp Wed Oct 12 10:49:29 2022 +0000 +++ b/main.cpp Wed Oct 12 11:25:20 2022 +0000 @@ -64,7 +64,7 @@ m3pi.sensor_auto_calibrate(); /*Create pitlog used to log the number of pitstop */ - PS_CreateLog(); + PS_CreateLog(); // TE_CreateVoltageLog(); while (1) { @@ -78,6 +78,7 @@ { /*Add one to the nummber allready in the pitlog*/ PS_AddStopToLog(); + /*Run the pitstop function*/ PS_PitStop(); } @@ -230,15 +231,13 @@ void PS_CreateLog(void){ /* Create a pitlog file and test if it can open*/ FILE *fptr; - fptr = fopen(PITLOGPATH,"w"); - - if(fptr == NULL) - { - printf("Error creating log file "); - exit(1); - } - fprintf(fptr,"%d", 0); - fclose(fptr); + + if ((fptr = fopen(PITLOGPATH,"r")) == NULL){ + fptr = fopen(PITLOGPATH,"w"); + fprintf(fptr,"%d", 0); + fclose(); + } + } void PS_AddStopToLog(void){ @@ -307,5 +306,3 @@ fclose(fptr); } - -