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.
Dependencies: mbed MatrixMath Matrix nrf51_rtc BMP180 MPU9250
Diff: main.cpp
- Revision:
- 6:e9a2bc040ada
- Parent:
- 5:d87c25f009d1
--- a/main.cpp Sat Jul 27 12:17:25 2019 +0000
+++ b/main.cpp Sun Aug 04 11:38:08 2019 +0000
@@ -60,7 +60,7 @@
#include "time_config.h" //Time configuration and util
#include "file_comands.h" //File comands
#include "ble_comands.h" //ble
-
+#include "Inatividade.h" //Inatividade
void SensorStart()
{
@@ -241,31 +241,38 @@
ti = ((float) tempCount) / 333.87f + 21.0f; // Temperature in degrees Centigrade
aa= 44330.0f*( 1.0f - pow((pressure/101325.0f), (1.0f/5.255f))); // Calculate altitude in meters
wait_us(1);
- //////////////////////////// Is there a new step? //////////////////
- kalman(ax, ay, az, gx, gy, gz, &Yaw, &Pitch, &Roll, &P, (1/Freq));
- int result=findPeaks(Pitch, Threshold/4, Threshold);
- if(result>0)
+ //////////////////////////// Inatividade ///////////////////////////
+ Inatividade();
+
+ if (flagInativ==0)
{
- steps=steps+result;
- result=0;
- iiSearch=0;
- ////////////////////////////Printing Values/////////////////////////
- ask_time(buff);
- //sprintf(buff_Values,"%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.2f,%2.0f,%2.0f,%d\r\n",ax, ay, az, gx, gy, gz, mx, my, mz, aa, ta, ti, frame);
- sprintf(buff_Values,"Steps %d \r\n",steps);
- strcat(buff,buff_Values);
-
- ///////////////////////////////Cheking if the day changed/////////////////////////////////////
- ask_day(day2);
- if (strcmp (day2,day1) != 0) //compare todays day with the day that the file was created
- {
- new_file(); //cria novo arquivo
- ask_day(day1);
- } // end if
- //////////////////////////////////////////////////////////////////////////////////////////////
- Open.printf(buff); //Printing values on the SD card
- } //end if flag print
- flagNewCapture = false;
+
+ //////////////////////////// Is there a new step? //////////////////
+ kalman(ax, ay, az, gx, gy, gz, &Yaw, &Pitch, &Roll, &P, (1/Freq));
+ int result=findPeaks(Pitch, Threshold/4, Threshold);
+ if(result>0)
+ {
+ steps=steps+result;
+ result=0;
+ iiSearch=0;
+ ////////////////////////////Printing Values/////////////////////////
+ ask_time(buff);
+ //sprintf(buff_Values,"%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.4f,%2.2f,%2.0f,%2.0f,%d\r\n",ax, ay, az, gx, gy, gz, mx, my, mz, aa, ta, ti, frame);
+ sprintf(buff_Values,"Steps %d \r\n",steps);
+ strcat(buff,buff_Values);
+
+ ///////////////////////////////Cheking if the day changed/////////////////////////////////////
+ ask_day(day2);
+ if (strcmp (day2,day1) != 0) //compare todays day with the day that the file was created
+ {
+ new_file(); //cria novo arquivo
+ ask_day(day1);
+ } // end if
+ //////////////////////////////////////////////////////////////////////////////////////////////
+ Open.printf(buff); //Printing values on the SD card
+ } //end if flag print
+ } //end if inatividade
+ flagNewCapture = false;
} // end if flag new capture
} // end while true
} //end main
\ No newline at end of file