Nikola Milenic / GPSM
Revision:
4:61f6f5ae0f8c
Parent:
3:467dee159d16
--- a/GPSM.cpp	Thu Dec 13 20:29:18 2018 +0000
+++ b/GPSM.cpp	Wed Jun 12 21:49:16 2019 +0000
@@ -16,10 +16,7 @@
 char    GPSM::ew             =   ' ';
 Serial* GPSM::_gps           =     0;
 bool    GPSM::ready          = false;
-#ifdef OPEN_LOG
-bool GPSM::is_logging = false;
-Logger* _openLog = 0;
-#endif
+
 void GPSM::GPSM_Init(PinName tx, PinName rx)
 {
 
@@ -39,33 +36,16 @@
 
     dec_longitude = 0.0;
     dec_latitude = 0.0;
-#ifdef OPEN_LOG
-    is_logging = false;
-    _openLog=new Logger()
-#endif
+
+    extern Serial pc;
+    
     init_GPS();
+    
     wait(1.0);
-    _gps->attach(callback(GPSM::rx_interrupt));
+
 }
 
 
-#ifdef OPEN_LOG
-void GPSM::start_log()
-{
-    is_logging = true;
-}
-
-void GPSM::new_file(void)
-{
-    _openLog->newFile();
-}
-
-void GPSM::stop_log(void)
-{
-    is_logging = false;
-}
-#endif
-
 float GPSM::nmea_to_dec(float deg_coord, char nsew)
 {
     int degree = (int)(deg_coord/100);
@@ -78,15 +58,10 @@
     return decimal;
 }
 
+
 int GPSM::poll()
 {
     if (!ready) return NOT_READY;
-#ifdef OPEN_LOG
-    if (is_logging && lock) {
-        format_for_log();
-        _openLog->write(bfr);
-    }
-#endif
     ready=false;
     if (lock) return GOOD;
     else return NO_LOCK;
@@ -96,6 +71,7 @@
 // INTERNAL FUNCTINS ////////////////////////////////////////////////////////////
 void GPSM::rx_interrupt()
 {
+    extern Serial pc;
     if(msg_ind < 0) {
         if(_gps->getc() == '$') msg_ind = 0;
         return;
@@ -233,21 +209,6 @@
     return v;
 }
 
-void GPSM::format_for_log()
-{
-    bfr[0] = '$';
-    for (int i = 0; i < 1022; i++) {
-        bfr[i+1] = msg[i];
-        if (msg[i] == 0 || msg[i] =='$') {
-            bfr[i+1] = '\r';
-            bfr[i+2] = '\n';
-            bfr[i+3] = 0;
-            return;
-        }
-    }
-    error("Overflow in format");
-}
-
 // GET FUNCTIONS /////////////////////////////////////////////////////////////////
 float GPSM::get_nmea_longitude()
 {