The HexiHeart is a demo project product that takes advantage of many of the onboard Hexiwear sensors and capabilities to create a multifunctional fitness and safety watch.

Dependencies:   FXAS21002 FXOS8700 Hexi_KW40Z Hexi_OLED_SSD1351 MAXIM W25Q64FVSSIG HTU21D MPL3115A2 TSL2561

Fork of HexiHeart_Alex by Hexiwear_zeta

Files at this revision

API Documentation at this revision

Comitter:
asong
Date:
Tue May 08 03:05:45 2018 +0000
Parent:
20:990951205fbd
Child:
22:3de592f8e696
Commit message:
Fixed some refreshing of values

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon May 07 21:49:35 2018 +0000
+++ b/main.cpp	Tue May 08 03:05:45 2018 +0000
@@ -21,6 +21,10 @@
 Display data screen update routines
 
 **************   Versions  ****************
+V2.17 - Added heart rate measurement to the main screen when any of the heart
+rate features are enabled. Fixed some WDT resets with certain heart rate 
+vibrations.
+
 v2.16 - Cast rolling average calculations as float to reduce rounding error. 
 removed two screens from diagnostic because we don't use them.
 Changed FAP to AFP in two locations.  
@@ -82,7 +86,7 @@
 
 
 /* General  Definitions */
-#define SW_Ver          2.16    // For displaying software version
+#define SW_Ver          2.17    // For displaying software version
 #define LED_ON          0
 #define LED_OFF         1
 #define SCRN_TIME       10.0    // Set OLED screen turn off time to 10.0 seconds
@@ -1781,8 +1785,19 @@
             oled.Label((uint8_t *)"Heart Rate",18,5); // Display at x,y
             oled.Label((uint8_t *)"HR:",10,25); // Display at x,y
             sprintf(display_buff, "%u", Heart_Rate);
-            textProperties.fontColor = COLOR_RED; //Change font to red
-            oled.SetTextProperties(&textProperties);//Implement color change
+            if(Current_Zone == 1) {
+                textProperties.fontColor = COLOR_YELLOW;
+                    oled.SetTextProperties(&textProperties);
+                } else if(Current_Zone == 2) {
+                    textProperties.fontColor = COLOR_BLUE;
+                    oled.SetTextProperties(&textProperties);
+                } else if(Current_Zone == 3) {
+                    textProperties.fontColor = COLOR_GREEN;
+                    oled.SetTextProperties(&textProperties);
+                } else if(Current_Zone == 4) {
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);
+                }
             oled.Label((uint8_t *)display_buff,43,25); // Display at x,y
             textProperties.fontColor = COLOR_WHITE;
             oled.SetTextProperties(&textProperties);
@@ -4366,7 +4381,7 @@
             textProperties.fontColor = COLOR_WHITE;
             oled.SetTextProperties(&textProperties);
             if(Heart_Rate_Mode == 1) {
-                sprintf(text,"%i",Heart_Rate);
+                sprintf(text,"%i  ",Heart_Rate);
                 if(Current_Zone == 1) {
                 textProperties.fontColor = COLOR_YELLOW;
                     oled.SetTextProperties(&textProperties);
@@ -4392,9 +4407,20 @@
         case 7: {// Heart Rate Zone
             textProperties.fontColor = COLOR_WHITE;
             oled.SetTextProperties(&textProperties);
-            sprintf(display_buff, "%u", Heart_Rate);
-            textProperties.fontColor = COLOR_RED; //Change font to red
-            oled.SetTextProperties(&textProperties);//Implement color change
+            sprintf(display_buff, "%u  ", Heart_Rate);
+             if(Current_Zone == 1) {
+                textProperties.fontColor = COLOR_YELLOW;
+                    oled.SetTextProperties(&textProperties);
+                } else if(Current_Zone == 2) {
+                    textProperties.fontColor = COLOR_BLUE;
+                    oled.SetTextProperties(&textProperties);
+                } else if(Current_Zone == 3) {
+                    textProperties.fontColor = COLOR_GREEN;
+                    oled.SetTextProperties(&textProperties);
+                } else if(Current_Zone == 4) {
+                    textProperties.fontColor = COLOR_RED;
+                    oled.SetTextProperties(&textProperties);
+                }
             oled.Label((uint8_t *)display_buff,43,25); // Display at x,y
             textProperties.fontColor = COLOR_GREEN;
             oled.SetTextProperties(&textProperties); //implements the color change
@@ -4430,7 +4456,7 @@
             break;
         }//end case 21 
         case 31: {
-            sprintf(display_buff, "%u", Heart_Rate); // Convert int to char to display
+            sprintf(display_buff, "%u   ", Heart_Rate); // Convert int to char to display
             textProperties.fontColor = COLOR_RED;
             oled.SetTextProperties(&textProperties);
             oled.Label((uint8_t *)display_buff, 40, 25);
@@ -4469,7 +4495,7 @@
             break;   
         }   
         case 33: {
-            sprintf(display_buff, "%u", Heart_Rate); // Convert int to char to display
+            sprintf(display_buff, "%u   ", Heart_Rate); // Convert int to char to display
             if(Current_Zone == 1) {
                 textProperties.fontColor = COLOR_YELLOW;
                 oled.SetTextProperties(&textProperties);