runinig version

Dependencies:   C12832_lcd NetServices freezer_guard_running mbed

Fork of Freezer_Guard_prog by team moped

Files at this revision

API Documentation at this revision

Comitter:
fbitz
Date:
Tue Jun 16 11:16:33 2015 +0000
Parent:
1:356f5c46585f
Child:
3:94c8a14df287
Commit message:
coding std applied

Changed in this revision

freezer_guard.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/freezer_guard.lib	Thu Jun 11 09:01:12 2015 +0000
+++ b/freezer_guard.lib	Tue Jun 16 11:16:33 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/teams/team-moped/code/freezer_guard/#550514ed381f
+http://developer.mbed.org/teams/team-moped/code/freezer_guard/#4256f0041505
--- a/main.cpp	Thu Jun 11 09:01:12 2015 +0000
+++ b/main.cpp	Tue Jun 16 11:16:33 2015 +0000
@@ -2,11 +2,11 @@
 TODO:
 * Display entmüllen
 * Displayausgabefunktion anpassen (übergabe von koordinaten)
-* Emailfunktion anpassen (Text und Werte einsetzen)
-# wait anweisungen überprüfen und wenn möglich eliminieren
+OK Emailfunktion anpassen (Text und Werte einsetzen)
+OK wait anweisungen überprüfen und wenn möglich eliminieren
 # Datentypen reduzieren
 # Ungarische Notation einführen  (->  Coding Richtline)
-# bei printfunktionen string direkt übergeben
+OK bei printfunktionen string direkt übergeben
 #Doku
 #Demo VErsion mit Alarm bei >temp erstellen
 # DEBUG ausgaben entfernen
@@ -39,7 +39,7 @@
 #include "guard.h"
 #include "string.h"
 #define LIMIT -10   // Temperature Alarm Threshold
-byte bState;
+byte MAIN_bState;
 byte bError;
 char cString[25];
 char data_array[2];
@@ -47,17 +47,17 @@
 
 int main()
 {
-    int i8Value=0;
-    bState=0; //statemachine: 0=no Alarm, 1=Alarm and no Mail sent, 2=Alarm and Mail sent
+    int8 i8Value=0; //value has 8 bit + sign
+    MAIN_bState=0; //statemachine: 0=no Alarm, 1=Alarm and no Mail sent, 2=Alarm and Mail sent, 3= Pending Alarm Confirmed
     bError=0;
     vGuardInit(); 
     
     while(1){
     i8Value=readValue(MCP9808_ADDR);
     wait(1);
-    if(i8Value>LIMIT && bState==0) bState=1;
-    if(i8Value<LIMIT) bState=0;
-    switch(bState) {
+    if(i8Value>LIMIT && MAIN_bState==0) MAIN_bState=1;
+    if(i8Value<LIMIT) MAIN_bState=0;
+    switch(MAIN_bState) {
     case 0: { //normal case
         vLcdIntPrint(i8Value);
          break;
@@ -65,29 +65,26 @@
          
     case 1:{
         vLcdIntPrint(i8Value);
-        strcpy(cString,"Alarm!");
-        vLcdStringPrint(cString);        
+        vLcdStringPrint("Alarm!");        
         bError=SendMail(i8Value);
         vAudioAlarm();
-        bState=2;
+        MAIN_bState=2;
           break;
           }
     case 2:{
          vLcdIntPrint(i8Value);
-          strcpy(cString,"Mail Sent!");
-         vLcdStringPrint(cString);
+         vLcdStringPrint("Mail Sent!");
          vAudioAlarm();
           break;
             }
-    case 3:{                            //bState=3 could only be set by ISR
+    case 3:{                            //MAIN_bState=3 could only be set by ISR
          vLcdIntPrint(i8Value);
-         strcpy(cString,"Alarm Confirmed");
-         vLcdStringPrint(cString);
+         vLcdStringPrint("Alarm Confirmed");
          break;
             }        
     default:{
-           strcpy(cString,"State Machine Error!");
-          vLcdStringPrint(cString);
+         //  strcpy(cString,"State Machine Error!");
+          vLcdStringPrint("State Machine Error!");
           break;
           }
         }//state machine