ELEC2645 (2015/16) / Mbed 2 deprecated EL15PJT_Ranger

Dependencies:   N5110 SDFileSystem SRF02 TMP102 mbed

Fork of Ranger by Philip Thompson

Revision:
9:bc259fc22fa2
Parent:
8:fe6ebe807b9d
Child:
10:c9f3c22368f1
--- a/main.h	Wed Apr 27 09:09:55 2016 +0000
+++ b/main.h	Wed May 04 14:05:07 2016 +0000
@@ -62,7 +62,6 @@
 */
 Ticker ticker;
 Ticker ticker_srf02;
-//Ticker ticker_tone;
 Ticker ticker_standby;
 Timeout buzzoff;
 Timeout buzzon;
@@ -89,7 +88,7 @@
 @namespace  TimerFlags
 @brief Flags for use with timed interupts
 */
-volatile int g_timer_flag_led = 0, g_timer_flag_srf02 = 0,  g_timer_flag_tone = 0; /** Flag rised by interupts*/
+volatile int g_timer_flag_led = 0, g_timer_flag_srf02 = 0; /** Flag rised by interupts*/
 volatile int g_timer_flag_standby = 0;
 volatile int buzz_flag = 0;
 /**
@@ -102,22 +101,30 @@
 @namespace  RangePresets
 @brief Preset range of the differant alert levels
 */
-int r1 = 3,/*!< Upper limit of alert 1 */r2 = 10,/*!< Upper limit of alert 2 */r3 = 20,/*!< Upper limit of alert 3 */r4 = 30,/*!< Upper limit of alert 4 */r5 = 40,/*!< Upper limit of alert 5 */r6 = 50,/*!< Upper limit of alert 6 */r7 = 60; /*!< Upper limit of alert 7 */
-float avgdistance;
-int subpage; /*!< veriable to hold the page being viewed with in the submenu  */
-int page;/*!< veriable to hold the page being viewed with in the menu */
-int offset = 0;/*!< veriable to hold the offset and adjust the 0 Range point */
-int alert;/*!< veriable to hold the current alert level */
-int distance;/*!< veriable to hold the distance read from the srf02 sensor */
-float bright = 1;/*!< veriable to hold the current LED backlight of the 5110 LCD */
-char units = METRIC;/*!< veriable to hold the current unit type set to METRIC as default */
-int length, length1, length2, length3, length4;
-char buffer[14], buffer1[14], buffer2[14], buffer3[14], buffer4[14]; // each character is 6 pixels wide, screen is 84 pixels (84/6 = 14)
-float T;
-int standby = 1;
-float c =1; /// convertion factor from Cm to inch
-int check_flag = 0;
-
+float Traw;
+int totaldistance;
+int r1 = 03;/// Upper limit of alert 1
+int r2 = 10;/// Upper limit of alert 2
+int r3 = 20;/// Upper limit of alert 3
+int r4 = 35;/// Upper limit of alert 4
+int r5 = 50;/// Upper limit of alert 5
+int r6 = 65;/// Upper limit of alert 6
+int r7 = 80;/// Upper limit of alert 7
+float avgdistance =0; // Averaged Distance vale from ten previous readings
+int subpage; ///< veriable to hold the page being viewed with in the submenu
+int page;/// veriable to hold the page being viewed with in the menu
+int offset = 0;/// veriable to hold the offset and adjust the 0 Range point
+int alert;/// veriable to hold the current alert level
+int distance;/// veriable to hold the distance read from the srf02 sensor
+float bright = 1.0;/// veriable to hold the current LED backlight of the 5110 LCD
+int units = 1;/// veriable to hold the current unit type set to METRIC as default
+//int length, length1, length2, length3, length4; //
+char buffer[14], buffer1[14], buffer2[14], buffer3[14], buffer4[14],buffer5[14]; // each character is 6 pixels wide, screen is 84 pixels (84/6 = 14) not ended globale but reused frquently throuh out
+float T; /// Temperature value retured from TMP102 sensor
+int standby = 0; ///?????????????????????
+float c =1; /// convertion factor from Cm to inch 1 = metric no convertion
+int check_flag = 0; ///???????????
+float distbar;
 
 struct Alertlevel {
     char srr_led;  /// stead RED LED state
@@ -204,7 +211,7 @@
                     standby =0;
                     lcd.clear();
 
-                    if (units == METRIC) {
+                    if (units == 1) {
                         sprintf(buffer,"%0.2f Cm",avgdistance);
                         sprintf(buffer1,"****RANGE!****");
                         sprintf(buffer2,"DISTANCE");
@@ -231,10 +238,9 @@
 @endcode
 */
 void lcdoutput();
-
+void save();
 void timer_isr_led();
 void timer_isr_srf02();
-void timer_isr_tone();
 void timer_isr_standby();
 
 /** Called to increment to brightness by 0.2 each time when at 1 resets back to 0.0
@@ -250,8 +256,6 @@
 @endcode
 */
 void backlight();
-void Getdistance();
-void init_K64F();
 void sw2_isr();
 void sw1_isr();
 void setup();
@@ -317,8 +321,6 @@
 @endcode*/
 void setleds();
 void setbuzzer();
-
-
 void menu();
 /**
 {
@@ -377,13 +379,13 @@
             case 2:
                 if (g_sw2_flag) {
                     g_sw2_flag = 0;  // if it has, clear the flag
-                    if (units == METRIC) {
-                        units = IMPERIAL;
+                    if (units == 1) {
+                        units = 0;
                     } else {
-                        units = METRIC;
+                        units = 1;
                     }
                 }
-                if (units == METRIC) {
+                if (units == 1) {
                     sprintf(buffer3,"METRIC");
                     lcd.printString(buffer3,0,2);
                 } else {
@@ -567,6 +569,5 @@
 void submenu();
 void save();
 void load();
-void GetDistance();
 
 #endif
\ No newline at end of file